Skip to content

Apple Pay in mobile app

To integrate Apple Pay in your mobile application, use PassKit SDK or React Native Payments.

To make a payment, get PaymentToken and pass it in the payment or authorization request to the Demo PSP system, as described below.

If you decrypt the token, use another integration option described here.

Info

Before you start, make sure that you finished the registration with Apple. Apple Pay in the mobile app requires a direct sign-up.

Payment request with the encrypted Apple Pay token

Request

To get the payment with encrypted paymentData processed by Demo PSP, send the payment, authorization or charge request, where you should submit the encrypted Apple Pay token as the value of request.credit_card.token in the format described below.

The required format of the encrypted Apple Pay token sent as the card token

Submit the encrypted Apple Pay token in requests as the card token in the $begateway_apple_pay_1_0_0$<base64-encoded_paymentData_here> format, where:

  • $begateway_apple_pay_1_0_0$ is the required prefix for the encrypted Apple Pay token;
  • <base64-encoded_paymentData_here> is the encrypted paymentData property of the PaymentToken serialized into JSON and then converted to the Base64-strict format.

For recurring payments and payments with the saved card data, get the Demo PSP payment token by sending the request.additional_data.contract parameter in the payment, authorization or charge requests.

The required format of the JSON-serialized encrypted paymentData property
{
  "paymentData": {
    "version": "EC_v1",
    "header": {
      "publicKeyHash": "sMqKpcUQU8763PUTXhPSo98wlJsqdqxc4rBdqNEnb0U=",
      "ephemeralPublicKey": "MFkwEwYHKoZIzj0QAdYIKoZIzj0DAQcDQgAEcjh7gGVcf1z87WBF2CfNfD6LIzjxvb8fflmeVsN3U5ixHLuCrCp2gXipnVdpb0NVy1Jf6TvLlbPpUdD6LcyNg==",
      "transactionId": "8b1b1dade0bfbc8f1f6677889bd36191a235ca1f26736e3b96970459545ad56e"
    },
    "data": "eHaJz9z1jQL3K6h9aCxMK8rtrAJ33e3RS48uVSQtDOXKZkjQAdCG4zG3zoi04JFTcdxeD2D3Tswbe0gzRyZTjrLjqJWvTa1Zkk2tA8B3aOxi6vkv8DQtLWaEGdySwXLMwBVbXjKEWy3ZnXEQCn2nnUcycxUt4b4NV0IWXUNnlqQstwjI5l5inDIZk11LnRehCp6+wOcMeEFd2vH6eTv7poWwt4zL+WHqsJMQajk8UOFvccNX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GGKmh0dHA6Ly9vY3NwLmFwcGxlLmNvbS9vY3NwMDQtYXBwbGVyb290Y2FnMzAdBgNVHQ4EFgQUIJJxE+T5O8n5sT2KGworv9LkswDwYDVR0TAQHBAUwAwEBzAfBgNVHSMEGDAWgBS7sN6hWDOImqSKmd6+veuv2sskqzA3BgNVHR8EMDAuMCygKqAohiZodHRwOi8vY3JsLmFwcGxlLmNvbS9hcHBsZXJvb3RjYWczLmNybDAOBgNVHQ8BAf8EBAMCAQYwEAYKKoZIhvdjZAYCDgQCBQAwCgYIKoZIzj0EAwIDZwAwZAIwOs9yg1EWmbGG+zXDVspivQX7dkPdU2ijr7xnIFeQreJ+Jj3m1mfmNVBDY+d6cL+AjAyLdVEIbCjBXdsXfM4O5BnRd8LCFtlkGcmmCEm9U+Hp9G5nLmwmJIWEGmQ8Jkh0AADGCAY0wggGJAgEBMIGGMHoxLjAsBgNVBAMMJUFwcGxlIEFwcGxpY2F0aW9uIEludGVncmF0aW9uIENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUwIIWdihvKr0480wDQYJYIZIAWUDBAIBBQCggZUwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjExMTE2MDY1MDAzWjAqBgkqhkiG9w0BCTQxHTAbMA0GCWCGSAFlAwQCAQUAoQoGCCqGSM49BAMCMC8GCSqGSIb3DQEJBDEiBCDB2GozvMqU+QEjGh0WHMVNOlW6ZNeeXBnXWEDQd64otDAKBggqhkjOPQQDAgRIMEYCIQCGVTf3W+opgDSb6Mcr5FLbEaPSqt3wWHEBCgHDw2mgIhAK7azZOJ0FVJSbvz3pcUeFDOkP1C1ovCyDMGPyAHZwAAAAAAAA"
  }
}
Example of the payment request with the encrypted Apple Pay token
{
  "request": {
    "amount": 100,
    "currency": "USD",
    "description": "Apple Pay test transaction",
    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DNDMTA0QkIifQ=="
    }
  }
}
Response

The response to the payment request with Apple Pay token will be returned with the processing status and fully conforms to the payment or authorization transaction response.