Search Overlay

Create a Payment Token

POST /directdebit/v1/accounts/account_id/purchases

You can process a Direct Debit purchase request with a single-use token generated from the Customer Vault API and at the same time create a permanent payment token that will be associated with the customer's profile and that will be available for future requests in the Direct Debit API.

This request is currently supported for ACH and EFT bank accounts only.

The following example shows how to create a permanent payment token for an EFT account by using a single-use token. The value used for the paymentToken field in this request is the previously generated paymentToken that is returned in the response to an EFT single-use token creation request in the Customer Vault API.

curl -X POST https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "123456789",
"amount": 2599,
"customerIp": "192.0.126.111",
"dupCheck": true,
"merchantCustomerId": "eft_purchase01",
"eft": {
"paymentToken": "DNjEzMTM4NDg1",
"replaceWithMultiUsePaymentToken": true,
"paymentDescriptor": "Transaction"
}
} '

By default the Direct Debit processing system will check for duplicate transactions.

Prior to trying the example, you should:

  • Provide a unique merchant reference number for each transaction (if this value is not unique, and the number has been used in the past 90 days, the request will be flagged as a duplicate).
  • Replace the merchant account number (89987201 in the example above) in the URL with the test account number you received for the currency you wish to test.
  • Replace the API key (after the -u) with the API key you have received.

{
"links": [
{
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases/a02e52c7-c991-4418-966a-b62989cb0eae"
}
],
"merchantCustomerId": "eft_purchase01",
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"txnTime": "2016-12-14T15:12:18Z",
"status": "COMPLETED",
"currencyCode": "USD",
"merchantRefNum": "123456789",
"amount": 2599,
"customerIp": "192.0.126.111",
"dupCheck": true,
"eft": {
"replaceWithMultiUsePaymentToken": true,
"multiUsePaymentToken": "Def6jC0Opljot9d",
"accountHolderName": "First Company",
"paymentToken": "DNjEzMTM4NDg1",
"transitNumber": "22446",
"institutionId": "001",
"paymentDescriptor": "Transaction",
"accountNumber": "******55"
},
"profile": {
"id": "ef2abd0c-8475-4cd9-85c6-70e1e226533c"
},
"billingDetails": {
"street": "100 Queen Street West",
"street2": "Apt. 55",
"city": "Ottawa",
"state": "ON",
"country": "CA",
"zip": "M1M 1M1",
"phone": "6139991100"
}
}

The response includes a multiUsePaymentToken value in the eft object. You can now use this value as the paymentToken in any EFT Direct Debit request that can use this token in place of full bank account details , e.g., an EFT Purchase.

See our API Reference section for a full description of the parameters required for the request and returned in the response.

On this Page