Contents

ApplePayError

A customizable error type that you create to indicate problems with the address or contact information on an Apple Pay sheet.

Declaration

interface ApplePayError

Mentioned in

Overview

When you determine that there’s a problem with an address or contact information on the payment sheet, you can use ApplePayError to create a customized error message. Apple Pay highlights the area with an error and displays your message, making it easier for users to correct errors.

Users must resolve any errors that you report on the Apple Pay sheet before they can finalize their transaction.

The details you provide in an Apple Pay error include:

  • code — An error code that identifies the area of the error.

  • contactField — The specific field on the payment sheet with the error.

  • message — Your custom error message to display on the payment sheet.

For example, if you found an error in the postal code of the shipping address, create an ApplePayError with the custom message text "ZIP Code is invalid", as follows:

new ApplePayError("shippingContactInvalid", "postalCode", "ZIP Code is invalid")

Apple Pay highlights the postal code field and displays the message text on the payment sheet.

Topics

Creating an Apple Pay Error

Error Properties