Contract Querying and Creation
A contract record represents the Direct Debit associated with a customer record. There are two forms of contract record:
- Ad-hoc: This is where a Direct Debit is created at the bank for the customer, but no payments are requested unless you specifically input payments via the Payments or Bulk Payments API call.
- Scheduled: In this mode, a schedule for payments is stated at the outset and the system will create the relevant payments in the database approximately five working days before the payments become due. Schedules can usually be weekly or monthly, however the frequencies available will be communicated to you when the API details are provided.
Customers can have multiple contracts attached to them in order that they may have multiple payment streams being collected simultaneously.
GET/client/{clientCode}/customer/{customerId}/contractQueries the database for a contract or set of contracts#
Queries the database for a contract or set of contracts
directDebit/path/client-customer- clientCode
- customerId
Responses
200OK
- Contracts [ {
- Amount
- AtTheEnd
- Description
- DirectDebitReference
- Every
- ExtraInitialAmounts
- Id
- InitialAmount
- IsGiftAid
- NumberOfDebits
- PaymentDayInMonth
- PaymentMonthInYear
- ScheduleName
- Start
- Status
- StatusExplanation
- TerminationType
} ] - CustomerId
Example request
GET /client/{clientCode}/customer/{customerId}/contractcurl -L -g -X GET 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/{customerId}/contract' -H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"Contracts": [
{
"Amount": 1,
"AtTheEnd": "Expire",
"Description": "Collect an initial \u00a31.00 followed by 9 payments of\n\u00a31.00 on 15th of the month ending on 25th April 2017\n",
"DirectDebitReference": "LUISCT-MT000325",
"Every": 1,
"ExtraInitialAmounts": "",
"Id": "7aa8cef6-ec95-47a7-9ced-4aa0938559ab",
"InitialAmount": 1,
"IsGiftAid": true,
"NumberOfDebits": 10,
"PaymentDayInMonth": "15",
"PaymentMonthInYear": 7,
"ScheduleName": "DD Dates 1/15 - Fixed",
"Start": "2016-07-15T00:00:00.000Z",
"Status": "Active",
"StatusExplanation": "N/A",
"TerminationType": "Take certain number of debits"
}
],
"CustomerId": "19283a22-7442-4c92-b035-8fa7f5e6a9a0"
}POST/client/{clientCode}/customer/{customerId}/contractCreates a contract in the database#
For ad-hoc contracts, you will only need to pass scheduleName, start, terminationType, atTheEnd and isGiftAid.
directDebit/path/client-customer- clientCode
- customerId
- scheduleName
- scheduleId
- start
- numberOfDebits
- every
- isGiftAid
- initialAmount
- extraInitialAmounts
- amount
- finalAmount
- paymentMonthInYear
- paymentDayInMonth
- paymentDayInWeek
- terminationType
- atTheEnd
- terminationDate
- additionalReference
- customDirectDebitRef
- ScheduleName
- Start
- IsGiftAid
- TerminationType
- AtTheEnd
Responses
200OK
- Id
- Message
- directDebitRef
Example — query parameters
POST /client/{clientCode}/customer/{customerId}/contractcurl -L -g -X POST 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/{customerId}/contract?scheduleName=adhoc_monthly_free&start=2019-08-01&isGiftAid=false&terminationType=Until further notice&atTheEnd=Switch to further notice' \
-H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"DirectDebitRef": "LUISCT-MT000341",
"Id": "e39940cc-9917-4b9e-8da4-5da4866862f1"
}HTTP/1.1 400 Bad Request
{
"Message": "{scheduleName} is not given to any schedule of any service as a name\n"
}Example — request body
POST /client/{clientCode}/customer/{customerId}/contract{
"ScheduleName": "adhoc_monthly_free",
"Start": "2019-08-01T00:00:00.000",
"IsGiftAid": false,
"TerminationType": "Until further notice",
"AtTheEnd": "Switch to further notice"
}curl -L -g -X POST 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/{customerId}/contract' \
-H 'Content-Type: application/json' \
-H 'apiKey: {apiKey}' \
-d '{"ScheduleName":"adhoc_monthly_free","Start":"2019-08-01T00:00:00.000","IsGiftAid":false,"TerminationType":"Until further notice","AtTheEnd":"Switch to further notice"}'HTTP/1.1 200 OK
{
"DirectDebitRef": "LUISCT-MT000341",
"Id": "e39940cc-9917-4b9e-8da4-5da4866862f1"
}HTTP/1.1 400 Bad Request
{
"Message": "{scheduleName} is not given to any schedule of any service as a name\n"
}Contract statuses
Upon creation, a Contract Status will read “Active”. While a newly created contract is awaiting its first collection, it is inadvisable to attempt to make changes to the contract or to push ad-hoc payments to the contract as payments may be missed or marked unpaid without an attempt to collect being made. We recommend allowing the lead times that apply to your configuration to elapse before making changes to the contract or pushing ad-hoc payments into the system.
| Status | Description |
|---|---|
| Active | The contract is active and will either produce payments, if it is a scheduled contract, or accept ad-hoc payments, if it is an ad-hoc contract. |
| Inactive | The contract has been cancelled and is no longer active. It cannot produce or accept payments, scheduled or otherwise. |
For more information on a contract's status, the StatusExplanation
field can provide a more detailed explanation. This field is free text and we recommend that it
is stored and displayed to the end user as necessary.
Timeframes
You should also be aware that you must allow a minimum number of clear working days between setting up a contract and collecting the first payment, and a minimum number of clear working days between pushing a second or subsequent ad-hoc payment and its collection date on an active contract. The number of days required is configured per client and is not the same for all clients, so you should refer to the lead times that apply to your own configuration.
A working day means a banking day in the United Kingdom — Monday to Friday, excluding public and bank holidays. A list of bank holidays is at https://www.gov.uk/bank-holidays, and a date checker is provided at https://www.accesspaysuite.com/date.
While the above timeframes are the minimum required, we strongly recommend building a day or two of contingency into your processes so that you have time to rectify any problems encountered. We are unable under any circumstances to accept instructions for payments or new contracts after the appropriate cut off dates.