Create a Mobile Single-Use Token
POST /customervault/v1/singleusetokens
The Customer Vault API allows you to create single-use tokens, which are then used with a mobile device to process a purchase through the Card Payments API.
You can also use the single-use tokens for other requests in the Customer Vault API, such as creating profiles and creating permanent payment tokens.
You have to generate a new single-use token for each Card Payments or Customer Vault API transaction you wish to process. Single-use tokens are valid for only 15 minutes and are not consumed when used for a Verification request.
The example below shows you how to create a single-use token. In the response, you will find a paymentToken value that you would include with your authorization or purchase requests.
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/singleusetokens \
-u OT1625:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d '{
"card": {
"holderName": "MR. JOHN SMITH",
"cardNum": "4111111111111111",
"cardExpiry": {
"month": 12,
"year": 2019
},
"billingAddress": {
"street": "100 Queen Street West",
"street2": "Unit 201",
"city": "Toronto",
"country": "CA",
"state": "ON",
"zip": "M5H 2N2"
}
}
}'
Value | Required? | Type | Description |
---|---|---|---|
card | Yes | object | The card details, including card expiry date and billing address. |
{
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"paymentToken": "abcdefg23d32d2",
"timeToLiveSeconds": 899,
"card": {
"cardBin": "411111",
"lastDigits": "1111",
"holderName": "MR. JOHN SMITH",
"cardType": "VI",
"cardExpiry": {
"month": 12,
"year": 2019
}
},
"billingAddress": {
"street": "100 Queen Street West",
"street2": "Unit 201",
"city": "Toronto",
"country": "CA",
"state": "ON",
"zip": "M5H 2N2"
}
}
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 |
---|---|---|
billingAddress | object | This is the card billing address. |
card | object | This is the card that Paysafe will send to the payment network |
id | string | This is the ID for the request. |
paymentToken | string | This is the single-use payment token that will be used for the Authorization/Purchase request. |
timeToLiveSeconds | integer | This is the period of time the single-use token is valid before expiration, in seconds, returned in the response. |