Create a Google Pay Single-Use Token
POST /customervault/v1/googlepaysingleusetokens
The Customer Vault API allows you to create a Paysafe single-use token on top of the Google Pay single-use token returned on the Android device by Google Pay. The Paysafe token is then used 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 a single-use token on top of a Google Pay single-use token. The response contains a paymentToken value that you 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 values for the googlePayPaymentToken sub-elements with valid values from the Android device.
curl -X POST https://api.test.paysafe.com/customervault/v1/googlepaysingleusetokens \
-u OT1625:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"googlePayPaymentToken": {
"signature": "MEYCIQC3SyFpLO3yVxqYeVDeFJ8rHbkSSe4TyuATINrAMmzf9AIhALusXhNPJvWVoEUo5ZjSXIK8dx/GMswkdQiqp4/xCd/D",
"protocolVersion": "ECv1",
"signedMessage": "<signed_message_from_google_payment_api>"
}
}'
Value | Required? | Type | Description |
---|---|---|---|
googlePayPaymentToken | Yes | object | Payment data object generated from the Android device for Google Pay. |
The example response below is for a card that Google has on file for the customer. Some cards will have the paymentMethod parameter set to TOKENIZED_CARD, which means the card is registered with Android Pay.
{
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"paymentToken": "GTCJskXfjWqo34U",
"timeToLiveSeconds": 899,
"googlePayPaymentToken": {
"ephemeralPublicKey": "BDR57RpnLXtBEuKZfuVKNTym9u2q93bXxAds+Gpe0VwBw8nL6dyMaEENB4hnXRglx0QQYRHoxc1qKwNBqBnx4qY=",
"tag": "8EKZt7vGFjtvuukkWlc5U93h+PBxjB7YKJF/w32Wfk8=",
"paymentMethod": "CARD_ON_FILE",
"messageId": "AH2EjtdtxE5P5FVoHjoVhVJiaslejbWZePOtu2G2nyZYJpZVIWeNV_tJYodBbX9iuZWMCUe_aBOVim6sKd1u2-KUSia5C9WNqGw7tTVy1epkqjxDhMBCnxQ6C8WJcMJ9luBWWjOnrHzb",
"messageExpiration": "1506708174199"
},
"card": {
"status": "ACTIVE",
"cardBin": "411111",
"lastDigits": "8298",
"cardType": "VI"
}
}
Value | Type | Description |
---|---|---|
id | string | ID for the request. |
paymentToken | string | This is the single-use payment token that will be used for the Authorization/Purchase request. |
timeToLiveSeconds | integer | The period of time the single-use token is valid before expiration, in seconds, returned in the response. |
googlePayPaymentToken | object | Payment data object generated from the Android device for Google Pay. |
card | object | These are the details of the virtual card. |
See our full API Reference section for a complete description.