⚡️ Quickstart: set up a Direct Debit

Learn how to prepare for and set up a Direct Debit mandate quickly in our staging environment.

📘

Prerequisite

You have obtained a user access token by following the steps in the Authorization flow guide.


Step 1: Create customer

curl -X POST "https://staging.adfin.com/api/customers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_access_token" \
-d '{
    "name": "Adfin financial services Ltd",
    "people": [
        {
            "firstName": "John",
            "lastName": "Doe",
            "email": "ciprian+john@adfin.com",
            "phoneNo": "+447123456789"
        }
    ],
    "addresses": [
        {
        "city": "London",
        "postalCode": "1245",
        "country": "UK",
        "addressLine1": "Street"
        }
    ]
}'

Explanation:

  1. URL:
    • Use the base URL https://api.adfin.com/v1/api/customers for customer creation.
  2. Headers:
    • Content-Type: Set to application/json for JSON payloads.
    • Authorization: Use the Bearer token with your access token for authentication.
  3. Body:
    • name: The name of the customer (e.g., Adfin financial services Ltd).
    • people: An array with the details of associated contacts.
    • addresses: An array of addresses related to the customer.\

Replace your_access_token with a valid token for this request.


Example response

{
    "id": "066b7125-cc80-40f1-a220-3ef297b979db",
    "name": "Adfin financial services Ltd",
    "people": [
        {
            "firstName": "John",
            "lastName": "Doe",
            "email": "ciprian+john@adfin.com",
            "phoneNo": "+447527943282"
        }
    ],
    "addresses": [
        {
            "city": "London",
            "postalCode": "1245",
            "country": "UK",
            "addressLine1": "Street"
        }
    ],
    "directDebitMandate": {},
    "timezone": "Europe/London"
}

Step 2: Create Direct Debit mandate

Using the customer id generated in Step 1, you can now create a Direct Debit mandate for this customer.

curl -X PUT "https://staging.adfin.com/api/customers/{customerId}/directdebitmandates" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_access_token" \

Example response

{
    "id": "WiGr3EBGuORksFWPEj",
    "creationTime": "2024-11-05T04:50:32.132UTC",
    "status": "CREATED",
    "customer": {
        "id": "54e2ffc3-560e-413d-aadb-bfd8f8af4de6",
        "name": "Adfin financial services Ltd",
        "people": [
            {
                "firstName": "John",
                "lastName": "Doe",
                "email": "ciprian+john@adfin.com",
                "phoneNo": "+44567123456"
            }
        ],
        "addresses": [
            {
                "city": "London",
                "postalCode": "1245",
                "country": "UK",
                "addressLine1": "Street"
            }
        ],
        "directDebitMandate": {
            "status": "CREATED"
        },
        "timezone": "Europe/London"
    },
    "url": "https://console.adfin.com/dd-mandate/WiGr3EBGuORksFWPEj",
    "sender": {
        "name": "JS CAD SERVICES LIMITED"
    },
    "bankAccountNumber": ""
}

Step 3: Redirect customer to authorise Direct Debit mandate

If you’d prefer not to activate a Direct Debit payment workflow and just want to share the mandate auth link directly with the customer, simply use the URL in the url field (see the example response in Step 2). This will take the customer straight to the Direct Debit auth screen, hosted by Adfin!


URL example:

"url": "https://console.adfin.com/dd-mandate/WiGr3EBGuORksFWPEj"

Adfin hosted mandate authorisation screen UI: