---
title: ApplePayError
framework: applepayontheweb
role: symbol
role_heading: Class
path: applepayontheweb/applepayerror
---

# ApplePayError

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

## Declaration

```data
interface ApplePayError
```

## Mentioned in

Apple Pay on the Web Version 3 Release Notes Choosing an API for Implementing Apple Pay on Your Website Setting up the payment request API to accept Apple Pay

## Overview

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. note: ApplePayError requires Apple Pay API version 3 and later, and is only supported in Apple Pay JS API; it’s not available in the Payment Request API.

## Topics

### Creating an Apple Pay Error

- [ApplePayError](applepayontheweb/applepayerror/applepayerror.md)

### Error Properties

- [code](applepayontheweb/applepayerror/code.md)
- [contactField](applepayontheweb/applepayerror/contactfield.md)
- [message](applepayontheweb/applepayerror/message.md)
