Ginger Payments
Apple Pay

Store an Apple Pay payment token

POST
/v1/apple-pay/payment-tokens/persist/

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.

Apple describes the fields in its payment token format reference.

Authorization

apiKey
headerAuthorizationBasic <token>

Use your project's API key as the username and leave the password empty. Only use the API key from your server: it gives full access to your project.

Request Body

application/json
  1. body
setupToken*string

The setup_token from the payment_method_details of the Apple Pay transaction.

Formatuuid
data*string

Encrypted payment data from Apple, Base64-encoded.

signature*string

Signature of the payment and header data, Base64-encoded.

header*

Additional information Apple uses to decrypt and verify the payment.

version*string

Version of the payment token, such as EC_v1.

Response Body

The payment details you need to execute the payment.

application/json
  1. response
vaultToken?string

Token of the card in the vault.

Formatuuid
onlinePaymentCryptogram?string

The cryptogram of the payment.

eciIndicator?string

The Electronic Commerce Indicator (ECI).

curl -X POST 'https://api.dev.gingerpayments.com/v1/apple-pay/payment-tokens/persist/' \  -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"}