Class

ApplePaySession

A session object for managing the payment process on the web.

Overview

ApplePaySession is the entry point for Apple Pay on the web. All the steps of the payment process for a single transaction occur in a session.

ApplePaySession belongs to the Apple Pay JS API.

Topics

Determining Support for API and Payments

supportsVersion

Detects whether a web browser supports a given Apple Pay version.

canMakePayments

Indicates whether the device supports Apple Pay.

canMakePaymentsWithActiveCard

Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.

Creating An Apple Pay Session

ApplePaySession(version, paymentRequest)

The entry point for Apple Pay on the web.

Getting Merchant Validation

begin

Begins the merchant validation process.

onvalidatemerchant

An event handler that is called when the payment sheet is displayed.

completeMerchantValidation

Completes the validation for a merchant session.

ApplePayValidateMerchantEvent

An event object that contains the validation URL.

Handling Payment Method Updates

onpaymentmethodselected

An event handler that is called when a new payment method is selected.

completePaymentMethodSelection

Completes the selection of a payment method with an update.

ApplePayPaymentMethodUpdate

Updated transaction details resulting from a change in payment method.

ApplePayPaymentMethodSelectedEvent

An event object that contains the payment method.

ApplePayPaymentMethod

A dictionary that describes an Apple Pay payment card.

Handling Shipping Contact Updates

onshippingcontactselected

An event handler that is called when a shipping contact is selected in the payment sheet.

completeShippingContactSelection

Completes the selection of a shipping contact with an update.

ApplePayShippingContactSelectedEvent

An event object that contains the shipping address selected by the user.

ApplePayShippingContactUpdate

Updated transaction details resulting from a change in shipping contact, including any errors.

Handling Shipping Method Updates

onshippingmethodselected

An event handler that is called when a shipping method is selected.

completeShippingMethodSelection

Completes the selection of a shipping method with an update.

ApplePayShippingMethodSelectedEvent

An event object that contains the shipping method.

ApplePayShippingMethodUpdate

Updated transaction details resulting from a change in shipping method.

Handling Payment Authorization

onpaymentauthorized

An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.

completePayment

Completes the payment authorization with a result.

ApplePayPaymentAuthorizedEvent

An event object that contains the token used to authorize a payment.

ApplePayPayment

The result of authorizing a payment request that contains payment information.

ApplePayPaymentAuthorizationResult

The result of payment authorization, including status and errors.

Ending the Session

oncancel

An event handler that is automatically called when the payment UI is dismissed.

abort

Aborts the current Apple Pay session.

Displaying an Apple Pay Setup Button

openPaymentSetup

A method that displays the Set up Apple Pay button.

Status Code Constants

STATUS_FAILURE

The requested action failed.

STATUS_INVALID_BILLING_POSTAL_ADDRESS

The billing address is invalid.

STATUS_INVALID_SHIPPING_CONTACT

The shipping contact information is invalid.

STATUS_INVALID_SHIPPING_POSTAL_ADDRESS

The shipping address is invalid.

STATUS_PIN_INCORRECT

The PIN information is not valid.

STATUS_PIN_LOCKOUT

The maximum number of tries for a PIN has been reached and the user has been locked out.

STATUS_PIN_REQUIRED

The required PIN information was not provided.

STATUS_SUCCESS

The requested action succeeded.

Relationships

Inherits From

See Also

Apple Pay Session

Creating an Apple Pay Session

Provide a payment request and create the session.

Providing Merchant Validation

Validate your merchant identity and receive a session object for each payment request.

Requesting an Apple Pay Payment Session

Request a valid session from the Apple Pay server.