Payment-method icon

Apple Pay express checkout

Configure the Apple Pay Component for express checkout in your React Native app.

You can configure the Apple Pay Component for express checkout to offer your shoppers the option to pay with fewer steps. In the express checkout flow, you request the shopper's billing and shipping information from the Apple Pay sheet, which speeds up the checkout process.

Requirements

Requirement Description
Integration type An Advanced flow React Native Components integration, v2.11.0 or later.
Limitations
  • Apple Pay express checkout is available on iOS only.
  • Coupon codes require iOS 15 or later.
Setup steps Before you begin, make sure that you have:

How it works

For express checkout, the shopper completes the payment inside the Apple Pay sheet. You configure the Apple Pay Component with the callbacks that update the sheet as the shopper makes their selections.

Integration steps

To offer express checkout with Apple Pay:

  1. Configure the Apple Pay sheet.
  2. Configure the callback to handle shipping contact changes.
  3. Configure the callback to handle shipping method changes.
  4. Configure the callback to handle coupon code changes.
  5. Configure the callback to validate the payment.
  6. Show the Apple Pay button on your product or cart screen.

Shopper checkout experience

When the shopper checks out with Apple Pay:

  1. The shopper selects the Apple Pay button, and the Apple Pay sheet opens.
  2. The shopper selects a shipping contact, selects a shipping method, or enters a coupon code. The Component calls the matching callback each time.
  3. In the callback, you call resolve with updated summary items, updated shipping methods, or errors. The Apple Pay sheet shows what you pass.
  4. The shopper authorizes the payment with Face ID or Touch ID. The Component calls onAuthorize before the payment is submitted, so that you can run your own checks.
  5. You submit the payment from your server.
CnNlcXVlbmNlRGlhZ3JhbQogICAgcGFydGljaXBhbnQgU2hvcHBlcgogICAgcGFydGljaXBhbnQgU2hlZXQgYXMgQXBwbGUgUGF5IHNoZWV0CiAgICBwYXJ0aWNpcGFudCBDb21wb25lbnQgYXMgQXBwbGUgUGF5IENvbXBvbmVudAogICAgcGFydGljaXBhbnQgQXBwIGFzIFlvdXIgYXBwCiAgICBwYXJ0aWNpcGFudCBTZXJ2ZXIgYXMgWW91ciBzZXJ2ZXIKICAgIHBhcnRpY2lwYW50IEFkeWVuCgogICAgU2hvcHBlci0+PkFwcDogMS4gU2VsZWN0IHRoZSBBcHBsZSBQYXkgYnV0dG9uCiAgICBBcHAtPj5Db21wb25lbnQ6IFN0YXJ0IHRoZSBDb21wb25lbnQKICAgIENvbXBvbmVudC0+PlNoZWV0OiBPcGVuIHRoZSBBcHBsZSBQYXkgc2hlZXQKICAgIGxvb3AgRWFjaCB0aW1lIHRoZSBzaG9wcGVyIGNoYW5nZXMgYSBzZWxlY3Rpb24KICAgICAgICBTaG9wcGVyLT4+U2hlZXQ6IDIuIFNlbGVjdCBhIHNoaXBwaW5nIGNvbnRhY3Qgb3Igc2hpcHBpbmcgbWV0aG9kLCBvciBlbnRlciBhIGNvdXBvbiBjb2RlCiAgICAgICAgQ29tcG9uZW50LT4+QXBwOiBDYWxsIHRoZSBtYXRjaGluZyBjYWxsYmFjawogICAgICAgIEFwcC0tPj5Db21wb25lbnQ6IDMuIENhbGwgcmVzb2x2ZSB3aXRoIHVwZGF0ZWQgc3VtbWFyeSBpdGVtcywgc2hpcHBpbmcgbWV0aG9kcywgb3IgZXJyb3JzCiAgICAgICAgQ29tcG9uZW50LT4+U2hlZXQ6IFNob3cgdGhlIHVwZGF0ZQogICAgZW5kCiAgICBTaG9wcGVyLT4+U2hlZXQ6IDQuIEF1dGhvcml6ZSB0aGUgcGF5bWVudCB3aXRoIEZhY2UgSUQgb3IgVG91Y2ggSUQKICAgIENvbXBvbmVudC0+PkFwcDogQ2FsbCBvbkF1dGhvcml6ZQogICAgQXBwLS0+PkNvbXBvbmVudDogQ2FsbCBhY3Rpb25zLnJlc29sdmUoKSBvciBhY3Rpb25zLnJlamVjdCgpCiAgICBDb21wb25lbnQtPj5BcHA6IFBheW1lbnQgZGF0YQogICAgQXBwLT4+U2VydmVyOiBQYXltZW50IGRhdGEKICAgIFNlcnZlci0+PkFkeWVuOiA1LiBTdWJtaXQgdGhlIHBheW1lbnQK

Configure the Apple Pay sheet

Configure the line items, the shipping methods that you offer, and the shopper details that you require:

  1. Create the shipping methods that you offer. Each shipping method is an ApplePayShippingMethod:

    Parameter Required Description
    label Required The name of the shipping method that the Apple Pay sheet shows, for example Standard shipping.
    amount Required The cost of this shipping method.
    identifier Recommended Your own identifier for this shipping method. The Component returns this value to you in onShippingMethodChange, so set it if you need to tell your shipping methods apart.
    detail A description that the Apple Pay sheet shows under the label, for example the carrier or the delivery time.
    startDate The earliest delivery date, in ISO 8601 date format.
    endDate The latest delivery date, in ISO 8601 date format.
  2. Add the following to the applepay object in your AdyenCheckout configuration, in addition to the parameters that every Apple Pay integration needs:

    Parameter Required Description
    summaryItems Required The items that make up the payment. The last item is the total that the Apple Pay sheet shows to the shopper.
    shippingMethods Required The shipping methods that you created in step 1.
    requiredShippingContactFields The shipping fields that you need from the shopper to fulfill the order. Possible values: postalAddress, name, phoneticName, phone, email.
    supportsCouponCode Set to true to show the coupon code field in the Apple Pay sheet. Requires iOS 15 or later.
    couponCode A coupon code to prefill in the coupon code field.

    Apple Pay amounts are not in minor units. Adyen uses integer minor units, and Apple uses decimal values. Make sure that the last summary item matches the amount that you submit to Adyen.

  3. Add the callbacks that you want to handle.

Configure the callback to handle shipping contact changes

If the shopper selects or changes their shipping address, offer the shipping methods that you support for that address and recalculate the total:

  1. Implement the onShippingContactChange callback. It receives the shopper's ApplePayPaymentContact and a resolve function.

  2. Call resolve with an ApplePayShippingContactUpdateRequest that contains the following:

    Parameter Required Description
    paymentSummaryItems The updated summary items. If you omit this, the Component keeps the current items.
    shippingMethods The shipping methods that you offer for this address. If you omit this, the Component keeps the current methods.
    errors The errors to show in the Apple Pay sheet. The sheet stays open so that the shopper can correct the address.

    To reject an address that you cannot ship to, pass an error instead of new shipping methods.

Configure the callback to handle shipping method changes

If the shopper selects a different shipping method, add the cost of that method to the total:

  1. Implement the onShippingMethodChange callback. It receives the selected ApplePayShippingMethod and a resolve function.

  2. Call resolve with an ApplePayShippingMethodUpdateRequest that contains the following:

    Parameter Required Description
    paymentSummaryItems The updated summary items, including the cost of the selected shipping method. If you omit this, the Component keeps the current items.

Configure the callback to handle coupon code changes

If the shopper enters or changes a coupon code, apply a discount or tell the shopper that the code is not valid:

  1. Set supportsCouponCode to true to show the coupon code field.

  2. Implement the onCouponCodeChange callback. It receives the coupon code and a resolve function.

  3. Call resolve with an ApplePayCouponCodeUpdateRequest that contains the following:

    Parameter Required Description
    paymentSummaryItems The updated summary items, including the discount. If you omit this, the Component keeps the current items.
    shippingMethods The shipping methods that you offer with this coupon code applied. If you omit this, the Component keeps the current methods.
    errors The errors to show in the Apple Pay sheet. The sheet stays open so that the shopper can correct the code.

    To reject a code that is not valid, pass an error instead of a discount.

Configure the callback to validate the payment

Before the payment is submitted, run your own checks on the shopper details that you collected in the Apple Pay sheet:

  1. Implement the onAuthorize callback. It receives an ApplePayPaymentAuthorization, which contains the billing contact, the shipping contact, and the shipping method that the shopper selected, plus an actions object.

  2. Call one of the following on the actions object:

    Action Description
    actions.resolve() Continue with the payment.
    actions.reject(errors) Stop the payment and show the errors in the Apple Pay sheet. The sheet stays open so that the shopper can correct the problem.

Show the Apple Pay button

Place the Apple Pay button where you want to offer express checkout, for example on your product or cart screen. The shopper selects Apple Pay there instead of going to your checkout, so Apple Pay is already the chosen payment method when the sheet opens.

To show the button:

  1. Check that Apple Pay is available on the device. Call AdyenApplePay.isAvailable, passing:

    • The Apple Pay payment method: the object with type applepay from your /paymentMethods response.
    • Your AdyenCheckout configuration.

    The method resolves to true when the shopper can pay with Apple Pay.

  2. Render an ApplePayButton when Apple Pay is available:

    Parameter Required Description
    onPress Required Called when the shopper selects the button. Start the Component from here.
    theme The button theme. Possible values: WHITE, WHITE_OUTLINE, BLACK, AUTOMATIC. Default: WHITE.
    type The label on the button, for example BUY, CHECKOUT, ORDER, or PLAIN. Default: BUY.
    radius The corner radius of the button.
    style A React Native style to apply to the button.
  3. In onPress, start the Component with the applepay payment method type. Use the start function from the useAdyenCheckout hook.

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 > Payments > Payment list.

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.

Set up Apple Pay on your Apple Pay Developer account for your live merchant identifier.

Apple Pay sheet errors

Use an ApplePayError to tell the shopper what to correct. The Apple Pay sheet stays open and highlights the field that you specify.

Parameter Required Description
type Required The kind of error.
message Required The message that the Apple Pay sheet shows to the shopper. Translate this into the shopper's language.
field The field that is not valid. The Apple Pay sheet highlights this field.

Error types

Value Use when
shippingAddress A field in the shipping address is not valid.
billingAddress A field in the billing address is not valid.
contactField A contact field, such as the email address or the phone number, is not valid.
couponCode The coupon code is not valid.

Error fields

Set field to the part of the address or the contact that the shopper must correct. The value depends on the error type:

Error type Set field to
shippingAddress or billingAddress A CNPostalAddress key, for example postalCode, city, street, country, or countryCode.
contactField A PKContactField name, for example phoneNumber, emailAddress, name, or postalAddress.

Code samples

The following code samples show the steps on this page in full.

See also