Create a Direct Debit Single-Use Token
POST /customervault/v1/achsingleusetokens
The Customer Vault API allows you to create Direct Debit single-use tokens, which can then be used to process Purchases and Standalone Credits through the Direct Debit API or when using Paysafe Checkout.
You can also use the Direct Debit single-use tokens for other requests in the Customer Vault API, such as creating profiles and creating bank accounts.
You have to generate a new single-use token for each Direct Debit or Customer Vault API request you wish to process. Single-use tokens are valid for only 15 minutes.
The example below shows you how to create an ACH single-use token. In the response, you will find a paymentToken value that you would include with your Direct Debit Purchase or Standalone Credit, or with Paysafe Checkout requests.
To create an EFT single-use token instead of an ACH single-use token:
- Send the request to the eftsingleusetokens endpoint
- Replace the achBankAccount object with an eftBankAccount object like the following:
"eftBankAccount": {
"accountNumber": "5002205",
"accountHolderName": "R. Smith",
"transitNumber": "20250",
"institutionId": "001"
}
See our full API Reference section for a complete description of parameters required.
Before trying the example, you should:
- Replace the API key (after the u) with your API key for single-use tokens.
curl -X POST https://api.test.paysafe.com/customervault/v1/achsingleusetokens \
-u OT1625:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d '{
"profile": {
"firstName": "John",
"lastName": "Smith",
"dateOfBirth": {
"year": 1981,
"month": 10,
"day": 24
},
"email": "john.smith@email.com"
},
"achBankAccount": {
"accountNumber": "50557600",
"accountHolderName": "R. Dodson",
"routingNumber": "123456789",
"accountType": "CHECKING"
},
"billingAddress": {
"nickName": "Home",
"street": "100 Queen",
"street2": "Unit 201",
"city": "Toronto",
"zip": "M5H 2N2",
"country": "CA",
"state": "ON"
}
}'
Value | Required? | Type | Description |
---|---|---|---|
profile | object | This is some optional information about the customer. | |
achBankAccount | Yes | object | These are the bank account details, including account number and routing number. |
billingAddress | Yes | object | This is the customer's billing address, including street, city, and country. |
{
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"paymentToken": "SAec6TpEoNVQpbSM",
"timeToLiveSeconds": 899,
"profile": {
"firstName": "John",
"lastName": "Smith",
"dateOfBirth": {
"year": 1981,
"month": 10,
"day": 24
},
"email": "john.smith@email.com"
},
"billingAddress": {
"nickName": "Home",
"street": "100 Queen",
"street2": "Unit 201",
"city": "Toronto",
"zip": "M5H 2N2",
"country": "CA",
"state": "ON"
},
"achBankAccount": {
"accountNumber": "50557600",
"accountHolderName": "R. Dodson",
"routingNumber": "123456789",
"accountType": "CHECKING"
}
}
The response contains the paymentToken and a timeToLiveSeconds value which indicates how many seconds remain for this payment token. Single-use tokens last 15 minutes.
Value | Type | Description |
---|---|---|
id | string | This is the ID for the request. |
paymentToken | string | This is the single-use payment token that represents the ACH bank account and that will be used for the Purchase/Standalone Credit request. |
timeToLiveSeconds | integer | This is the period of time the single-use token is valid before expiration, in seconds. |
profile | object | This is some optional information about the customer. |
billingAddress | object | This is the customer's billing address. |
achBankAccount | object | These are the bank account details. |