Store an Apple Pay payment token
Decrypts the Apple Pay payment token and stores the card in the vault. Call it when Apple triggers the onpaymentauthorized event, with the contents of event.payment.token.paymentData and the setup_token of the transaction. Only for a server-to-server integration with your own checkout: with the hosted payment page you don't call this endpoint.
Test environment: with a test project, send the same request to /v1/apple-pay/test/payment-tokens/persist/ instead.
Apple describes the fields in its payment token format reference.
application/json- body
setupToken*stringThe setup_token from the payment_method_details of the Apple Pay transaction.
uuiddata*stringEncrypted payment data from Apple, Base64-encoded.
signature*stringSignature of the payment and header data, Base64-encoded.
header*Additional information Apple uses to decrypt and verify the payment.
version*stringVersion of the payment token, such as EC_v1.
The payment details you need to execute the payment.
application/json- response
vaultToken?stringToken of the card in the vault.
uuidonlinePaymentCryptogram?|The cryptogram of the payment. Pass it on when executing the payment.
eciIndicator?|The Electronic Commerce Indicator (ECI). Not every card network provides it, pass it on when present.
curl -X POST 'https://api.prod.smartpay.gingerpayments.com/v1/apple-pay/payment-tokens/persist/' \ --user "$API_KEY:" \ -H 'Content-Type: application/json' \ -d '{ "setupToken": "c6d0a22b-df22-41a2-aac1-d647173ff219", "data": "C+YChH...dTlaSmc=", "signature": "MIAGCSqGSIb3DQ...==", "header": { "publicKeyHash": "yFMDm...s=", "ephemeralPublicKey": "MFkwEwYHKo...SoHnSg==", "transactionId": "878...4c52" }, "version": "EC_v1"}'{ "vaultToken": "d972dc43-6a3d-4dcf-b54e-6e9a0fe325e3", "onlinePaymentCryptogram": "AgAAAAAABk4DWZ4C28yUQAAAAAA=", "eciIndicator": "7"}