Search Overlay

Create an Apple Pay Single-Use Token

POST /customervault/v1/applepaysingleusetokens

The Customer Vault API allows you to create single-use tokens, which are then used with an Apple device to process a purchase through the Card Payments API. Single-use tokens are valid for only 15 minutes and are not consumed by verification.

You have to generate a new single-use token for each Card Payments API transaction you wish to process.

The example below shows you how to create an Apple Pay single-use token. In the response, you will find a paymentToken value that you would include with your authorization or purchase request.

Before trying the example, you should:

  • Replace the API key (after the u) with your API key for single-use tokens.
  • Replace the value for the data element with valid PassKit encrypted payment data.
  • Replace the value for the signature element with valid payment signature and header data.
  • Replace the values for the header sub-elements with valid values from the iOS device.

curl -X POST https://api.test.paysafe.com/customervault/v1/applepaysingleusetokens \
-u OT1625:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"applePayPaymentToken": {
"version": "EC_v1",
"data": "<passkit_encrypted_payment_data>",
"signature": "<signature_for_payment_and_header_data>",
"header": {
"transactionId": "b53e22ef6669ce7f50951cfd6821908f4e679f050f5a551a1b5f6202253136ae",
"ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEB39YqvWZG0NOYjbkL5D61Mxip6uw23Q7m8gWgxL41k4fs0BgJ+MFcIGYOH86kAGL/wjiftDahRkUnzOGls2hzw==",
"publicKeyHash": "O5gJ/P5sQ7ufMZQXA7ccLoOkJ13VNknbu+4K0TaCQXE="
}
}
}'
Value Required? Type Description
applePayPaymentToken Yes object The payment data object generated from the iOS device for Apple Pay.

{
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"paymentToken" : "ABC4AFQQBC5UR5H",
"timeToLiveSeconds" : "899",
"applePayPaymentToken": {
"version": "EC_v1",
"signature": "<signature_for_payment_and_header_data>",
"header": {
"transactionId": "b53e22ef6669ce7f50951cfd6821908f4e679f050f5a551a1b5f6202253136ae",
"publicKeyHash": "O5gJ/P5sQ7ufMZQXA7ccLoOkJ13VNknbu+4K0TaCQXE="
}
},
"card": {
"lastDigits": "1111",
"holderName": "Joe Smith"
},
"transaction": {
"amount": 1000,
"currencyCode": "USD"
}
}
Value Type Description
applePayPaymentToken object This is the payment data object generated from the iOS device for Apple Pay.
card object These are the details of the virtual card.
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.
transaction object The Apple Pay transaction details.

See our full API Reference section for a complete description.

On this Page