Search

Are you looking for test card numbers?

Would you like to contact support?

Payment-method icon

Custom integration (Web)

Learn how you can submit a payment through Adyen using your existing Apple Pay JavaScript APIs implementation.

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 /payments 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 /payments request. The value of the payment.token in the additionalData object is the string from step 1.


{
  "amount": {
    "currency": "USD",
    "value": 1000
  },
  "reference": "Your order number",
  "paymentMethod": {
    "type": "applepay",
    "applepay.token": "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
  },
  "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}

Once you completed the steps above and tested your integration, contact Support Team to configure live processing of Apple Pay payments.