Payment flow with Apple Pay

The following payment method is specific to Apple devices.

Availability

Available for all 2Checkout merchants (2Sell, 2Subscribe, 2Monetize & 4Enterprise) using all or any of our ordering engines (hosted shopping cart, ConvertPlus, and InLine).

For more information on availability, see the main documentation page for Apple Pay here.

Requirements

Shoppers can use any device that supports Apple Pay and is located in one of the selected countries.

For more information on requirements, see the main documentation page for Apple Pay here.

Activation

For activation, you need to have Apple Pay enabled on your 2Checkout account. Contact the Merchant Support team to enable it. After 2Checkout sets up our domain, we will provide you with a domain verification file.

Host your domain verification file at the following path on our server: https://[DOMAIN_NAME]/.well-known/apple-developer-merchantid-domain-association.

Setting up Apple Pay

To set up Apple Pay, you need to build the frontend component and to initialize the session using the startApplePaySession method, providing the validationUrl to the payload. Once the token is received from the frontend component, it has to be sent to the decryptApplePayData endpoint in the 2Checkout API. This will return a data response from Apple Pay that needs to be used in the placeOrder call.

Frontend component

To set up an Apple Pay session in the shopper’s browser, follow these steps:

  1. Include the Apple Pay library.

  2. Add the Apple Pay button.

  3. Set up the Apple Pay function and create a session instance.

Backend component

Create endpoints on your server to interact with the 2Checkout API for Apple Pay. Follow these steps:

1

Initiate an Apple Pay session

Create an endpoint on your server to call to initiate an Apple Pay session. In order for a valid Apple Pay session to be created, an API call to the 2Checkout API needs to be sent, with the validationURL set to the ApplePay payment service.

Protocol
Endpoint

JSON-RPC

startApplePaySession

SOAP

startApplePaySession

startApplePaySession payload

2

Decrypt the Apple Pay token

Once the token is received from the frontend component, it has to be sent to the decryptApplePayData endpoint in the 2Checkout API. This will return a data response from Apple Pay that needs to be used in the placeOrder call.

Protocol
Endpoint

JSON-RPC

decryptApplePayData

SOAP

decryptApplePayData

decryptApplePayData payload

BODY: (ApplePayData property value should be the event.payment.token from the onpaymentauthorized event)

3

Place the order

Once the Apple Pay data is received from 2Checkout, this needs to be used in the Payment Method object of the Payment Details object in the API call to place an order.

Protocol
Endpoint

JSON-RPC

placeOrder

SOAP

placeOrder

Example placeOrder payload:

Last updated

Was this helpful?