Search Overlay

Direct Debit Payment with Token

Once you have received the Direct Debit single-use token from Paysafe Checkout, you can use it to make a payment using the Direct Debit API. The Direct Debit payment scheme used depends on the currency selected for the transaction.

If your transactions are in multiple currencies you need to consider how you will handle the multiple merchant accounts involved and select the correct one to use when taking payment.

Paysafe Checkout currently supports only EFT (CAD) and ACH (USD) Direct Debit payment requests.

The payment endpoint uses the server-to-server API key. Do not use the Direct Debit API from the client's web browser as this will expose this key.

Call the following endpoint from your server to take payment:

POST /directdebit/v1/accounts/account_id/purchases

curl -X POST https://api.test.paysafe.com/directdebit/v1/accounts/1001199750/purchases \
-u test_username:B-qa2-0-59564dfa-0-302c021426a55dde98dc2a052cccc1ddc8daa776a7a4fe2e0214080388fded986767abc445e58af123c01003cb8b \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "61544433",
"amount": 9988,
"customerIp": "192.0.126.111",
"ach": {
"paymentToken": "DcoFHClVLIrToBR",
"payMethod": "WEB"
}
} '

Prior to trying the example, you should:

  • Replace the account number (1001199750) in the URL with the Test account number you received from Paysafe, according to the currency you wish to use. In this example, it's an ACH object.
  • Replace the API key user name and password (after the -u) with the Test API key you have received from Paysafe.
  • Substitute the paymentToken with the Test Direct Debit token you obtained from Paysafe Checkout.

{
"merchantRefNum": "61544433",
"amount": 9988,
"ach": {
"lastDigits": "22",
"paymentToken": "DcoFHClVLIrToBR",
"accountHolderName": "Argon Corp.",
"accountType": "CHECKING",
"payMethod": "WEB",
"routingNumber": "123456789",
"accountNumber": "******22"
},
"profile": {
"firstName": "Jane",
"lastName": "Smith"
},
"customerIp": "192.0.126.111",
"dupCheck": true,
"id": "6c7fd6c4-6045-49ec-96ec-bb256d1fa191",
"txnTime": "2018-09-19T13:57:20Z",
"currencyCode": "USD",
"status": "COMPLETED",
"links": [{
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001199750/purchases/6c7fd6c4-6045-49ec-96ec-bb256d1fa191"
}]
}

For details on how to submit a Direct Debit purchase using a paymentToken, see the Purchases section of the Direct Debit API documentation.

Converting a Single-Use Token to a Permanent Token

You can convert the single-use token to a re-usable, permanent payment token, which makes it possible to implement capabilities such as recurring billing (perhaps used to pay a subscription) or a "remember me" feature. To do this, you can either: