Payment-method icon

Apple Pay Drop-in integration

Add Apple Pay to an existing Drop-in integration.

This page explains how to add Apple Pay to your existing Web Drop-in integration.

Requirements

Select which endpoint you are using:

API reference

You do not need to send additional fields for Apple Pay. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:

If you run into an error, refer to Handle Apple Pay errors.

Drop-in configuration

Select which endpoint you are using:

Optional configuration

This optional configuration parameter is only accepted on the dropin instance.

Instant payment button configuration

Use the instantPaymentTypes object to display the Apple Pay payment button at the top of the list of available payment methods. The sample below shows how to do this:

Optional Apple Pay configuration

You can do the following:

Button configuration

Property Description
buttonType The type of button you want to show on your payments form. Possible values:
- plain: Apple Pay
- buy: Buy with Apple Pay
- donate: Donate with Apple Pay
- check-out: Check out with Apple Pay
- book: Book with Apple Pay
- subscribe: Subscribe with Apple Pay

The following types are supported from Web Components v4.1.0:
- add-money: Add money with Apple Pay
- contribute: Contribute with Apple Pay
- order: Order with Apple Pay
- reload: Reload with Apple Pay
- rent: Rent with Apple Pay
- support: Support with Apple Pay
- tip:Tip with Apple Pay
- top-up: Top Up with Apple Pay
buttonColor Specify the color of the button you want displayed on the payment form. Possible values:
- black: Black button
- white: White button with no outline
- white-with-line: White button with black outline

Payment request data

Payment request data Configuration object Description
Transaction information

version

Check the Apple Pay on the Web documentation for version features and compatibility details.

totalPriceLabel String. Description of the line item.
lineItems A set of line items that explain recurring payments, additional charges, and discounts. Refer to Apple Pay documentation for sample values.
merchantCapabilities Payment capabilities supported by the merchant. Default value is [`supports3DS`]. Refer to Apple Pay documentation for other options.
shippingMethods List of available methods for shipping physical goods. Refer to Apple Pay documentation for sample values.
shippingType Optional value that indicates how purchased items are to be shipped. Refer to Apple Pay documentation for available options.
supportedCountries Specify the ISO 3166 country codes if you only support payments from cards issued in specific countries.
Requested billing and shipping contact information

requiredBillingContactFields

Billing information fields that you require from the shopper to process the transaction. Refer to Apple Pay documentation for sample values.

requiredShippingContactFields

Shipping information fields that you require from the shopper to fulfill the order. Refer to Apple Pay documentation for sample values.

Known contact information

billingContact

Set an up-to-date billing contact information for the shopper.

shippingContact

Set an up-to-date shipping contact information for the shopper.

Custom data

applicationData

A Base64-encoded string used to contain your application-specific data. For example, a shopping cart identifier or an order number that you will need to identify this transaction.

Recurring payments

recurringPaymentRequest

Required for recurring payments. Include to specify that the payment is a recurring payment.

Events

The following event handlers are supported for Apple Pay. Select the event handler names to see the related Apple Pay documentation.

Event Description
onClick(resolve, reject) Called when the shopper clicks the Apple Pay button. Call resolve() to continue or reject() to stop the payment flow.
onValidateMerchant Called when the payment sheet is displayed.
onPaymentAuthorized Also called after the shopper authorizes the payment with Apple Pay. This contains all the raw event from Apple Pay.
onPaymentMethodSelected Called when the shopper selects a new payment method.
onShippingContactSelected Called when the shopper selects a shipping contact.
onShippingMethodSelected Called when the shopper selects a shipping method.

Optional Apple Pay Wallet Order Tracking

Supported in v6.0.0 or later.

You can use Apple Pay Wallet Order Tracking to give your shopper order tracking through Apple Pay. For more information, refer to the following resources from Apple:

  1. Implement onOrderTracking:

  2. When onOrderTracking is called depends on which server-side flow your integration uses.

  3. From your server, get the order details and pass it as orderDetails to your client side.
    If an error occurs, the Apple Pay payment overlay is closed, and the payment is successfully completed without creating an order in the shopper's Apple Wallet app.

Recurring payments

Apple Pay supports tokenization for recurring transactions on v5.39.0 and later.

We strongly recommend that you ask explicit permission from the shopper if you intend to make future recurring payments. Being transparent about the payment schedule and the charged amount reduces the risk of chargebacks.

To enable recurring payments, you must include recurringPaymentRequest when configuring Apple Pay.

To make recurring payments, refer to Tokenization to:

  • Create a token through the initial payment
  • Use the token in subsequent payments.
  • Manage tokens.

Test and go live

Use Apple's test card numbers to test your integration.

For a full list of test cards and instructions how to add these to your test device, see Sandbox testing on Apple's Developer website.

Check the status of an Apple Pay test payment in your Customer Area > Transactions >  Payments.

Going live

To process live Apple Pay payments, your API credential needs to have the API Clientside Encryption Payments role. You can check this in your live Customer Area or ask your Admin user to verify.

See also