After initiating the Apple Pay payment on your website or mobile application, you should receive a token in the onPaymentAuthorized event.
Retrieve the paymentData
from the token and convert it to a string. Pass this to your server, and then submit it in an /authorise
request to Adyen.
Adyen supports 3DS only. To specify this in the ApplePay request, pass the merchantCapabilities
parameter set to 3DS: (when creating an ApplePay session) : var request = { merchantCapabilities: ['supports3DS'] }
Step 1: Stringify the paymentData from the token
ApplePay returns more data than we need for authorisation, for example a shipping address, but only the PaymentData
is necessary for authorisation. Take this data from the token and convert the JSON to a String:
session.onpaymentauthorized = function(event) { var token = JSON.stringify(event.payment.token.paymentData); };
Step 2: Submit the API request
The following example demonstrates how to submit an /authorise
request. The value of the payment.token
in the additionalData
object is the string from step 1.
{ "amount":{ "value":2000, "currency":"EUR" }, "reference":"Your Reference Here", "merchantAccount":"TestMerchant", "additionalData":{ "payment.token":"eyJkYXRhIjoiTkxUYVA5NUU0MlU1azlMYVpzRUpUSXVSQy4uLi4ZmY2NjIifSwidmVyc2lvbiI6IkVDX3YxIn0=" } }
Once you completed the steps above and tested your integration, contact Support Team to configure live processing of Apple Pay payments.