Integrating with Apple Pay
Most of the process of enabling the "Pay with Apple Pay" button in your app or site is performed during your wallet integration. For that reason, we recommend you to follow the instructions available in the Apple Developer Documentation website for Apple's self-service implementation.
At the end of the process performed in the Apple API, you will receive a JSON containing two important fields that will be used in "PART 3": the paymentData.data
and the ephemeralPublicKey.header.EphemeralPublicKey
fields.
{
"applePayData": {
"paymentData": {
"version": "EC_v1",
"data": "as01vRj+n9crY2vome7zc+u7Tz0+qg2La/8IUHpJIjFN6ThhUqLnSrskQHTrEbcYPiMksFK0+ddo9sZu70uJQJH1I+44N6PrVhilNDem97vOXq2VYDXiVJ27F/Q9wGQDgZBeGcZ6Pml9SIelHqUauBcQoOatrlnWPUL8kbdpT8WqgzXyaCh7oeTz=z6++rp/ofjvSjnGtOqAUsnrzvw4uzkcyKUSsfROdJ6B/Xzgu/T9fMIr5UxXD2DPF1SNh3ydEJABKz4HFjDW7ObvbQeua4GYxJdpQLpI3NgUbJy91E/LOyb/+PcCtO+0=a41tBrfnTTF9qsPuCIw8HWIEEKSRofn27NTofxev/i+nHEfqEtqNrN/epIvhzceD/gDiGetfiLKMzf94ARmpWUAMC==",
"signature": "(…)",
"header": {
"ephemeralPublicKey": "MFkwEwZJKoZIzj0CAQYIKo12zj0DAQcDQgAEo+ReGClSmQ4hDJD1yh9nci3V4l7kPm2AQtKZMMvuNS0iK5sn/1A9l3kw1B1xCqOycZmnPSng7p5hpTvrei1BCA==",
"publicKeyHash": "KXN06+BtJu6yEfF9zDhr7f4M/2HwVybnx0FGfC520gB=",
"transactionId": "71c5b61c3791546e94d2b4893a6c69aaac2ab86b5c113c83a7d89057906a9b5f"
}
},
"paymentMethod": {
"displayName": "MasterCard 1212",
"network": "MasterCard",
"type": "credit"
},
"transactionIdentifier": "81C5B61C3791646E94D2B4893A6C69BBBC2AB86B5C363C83A7D89057906A9BAC"
},
"x_document": "24562608994",
"x_name": "João da Silva"
}
Important Note
Warning
During Apple's implementation, there will be a reference to the ".CER" certificate, generated during STEP 1, to encrypt the data while communicating with Apple. In the integration flow do not implement the process of decrypting the data returned by Apple as this work is done by the API E-commerce Cielo.
PART 3: Integration with API E-commerce Cielo (decryption and authorization)
Authorization with the Apple Pay token happens in the same way as standard credit card authorization. However, instead of providing card details openly, the token received by Apple Pay must be provided, as in the example below:
Request
{
"MerchantOrderId": "2017051002",
"Customer": {
(…)
},
"Payment": {
"Type": "CreditCard",
"Amount": 1000,
"Installments": 1,
"Currency": "BRL",
"Wallet": {
"Type": "ApplePay",
"WalletKey":"['paymentData.data']",
"AdditionalData": {
"EphemeralPublicKey": "['ephemeralPublicKey.header.EphemeralPublicKey']"
}
}
}
}
Header Parameters | Description | Type and Size |
---|---|---|
MerchantId | Store ID in API E-commerce Cielo. | GUID (36) |
MerchantKey | API key in API E-commerce Cielo. | String (24) |
Parameter | Description | Type and Size |
---|---|---|
MerchantOrderId | Order ID number. | String (50) |
Customer | Node with customer's data. | Refer to API E-commerce Cielo. |
Payment.Type | Payment method type. Possibilities: "CreditCard" / "DebitCard". | String (100) |
Payment.Amount | Order amount in cents. | Number (15) |
Payment.Installments | Number of installments. | Number (2) |
Payment.Wallet.Type | Name of payment method provider. For Apple Pay transactions, use "ApplePay". | String (15) |
Payment.Wallet.WalletKey | Fill with the paymentData.data parameter value returned by Apple Pay. | String |
Payment.Wallet.AdditionalData.EphemeralPublicKey | Fill with the ephemeralPublicKey.header.EphemeralPublicKey parameter value returned by Apple Pay. | String |
Response
{
"MerchantOrderId": "2017051002",
"Customer": {(…)
},
"Payment": {
(…)
"CreditCard": {
(…)
},
(…)
"Wallet": {
"Type": "ApplePay",
"WalletKey": "as01vRj+n9crY2vome7zc+u7Tz0+qg2La/8IUHpJIjFN6ThhUqLnSrskQHTrEbcYPiMksFK0+ddo9sZu70uJQJH1I+44N6PrVhilNDem97vOXq2VYDXiVJ27F/Q9wGQDgZBeGcZ6Pml9SIelHqUauBcQoOatrlnWPUL8kbdpT8WqgzXyaCh7oeTz=z6++rp/ofjvSjnGtOqAUsnrzvw4uzkcyKUSsfROdJ6B/Xzgu/T9fMIr5UxXD2DPF1SNh3ydEJABKz4HFjDW7ObvbQeua4GYxJdpQLpI3NgUbJy91E/LOyb/+PcCtO+0=a41tBrfnTTF9qsPuCIw8HWIEEKSRofn27NTofxev/i+nHEfqEtqNrN/epIvhzceD/gDiGetfiLKMzf94ARmpWUAMC==",
"AdditionalData": {
"EphemeralPublicKey": "MFkwEwZJKoZIzj0CAQYIKo12zj0DAQcDQgAEo+ReGClSmQ4hDJD1yh9nci3V4l7kPm2AQtKZMMvuNS0iK5sn/1A9l3kw1B1xCqOycZmnPSng7p5hpTvrei1BCA=="
}
},
(…)
"Links": [
(…)
]
}
}
The wallet authorization response will have the same fields presented in API Reference, however with the addition of the Payment.Wallet
node repeating the same fields used in the authorization, as described above.
Updated 4 days ago