Customize Apple Pay

Customise the Apple Pay button appearance including style, type, and locale.

Button Options

Option Type Description
paymentRequestobjectApple Pay payment request overrides. Pass recurringPaymentRequest here to save the card together with save_payment_method: true, see Saving an Apple Pay card
buttonTypeApplePayButtonTypeButton label variant (see below)
buttonStyle'black' | 'white' | 'white-outline'Button colour
buttonLocalestringOverride the button locale (defaults to SDK locale)
disabledbooleanDisable the button

Button Types

Available buttonType values:

Value Label
plainApple Pay (no prefix)
buyBuy with Apple Pay
donateDonate with Apple Pay
checkoutCheck out with Apple Pay
bookBook with Apple Pay
subscribeSubscribe with Apple Pay
payPay with Apple Pay
orderOrder with Apple Pay
reloadReload with Apple Pay
add-moneyAdd Money with Apple Pay
top-upTop Up with Apple Pay
rentRent with Apple Pay
supportSupport with Apple Pay
contributeContribute with Apple Pay
tipTip with Apple Pay

Callbacks

Callback Description
onReadyFired when the element is mounted and ready
onChangeFired when availability changes ({ available: boolean })
onClickFired when the button is clicked
onSuccessFired on successful payment - receives PaymentSubmitResponse
onCancelFired when the user cancels the Apple Pay sheet
onErrorFired when an error occurs
onSessionStartedFired when the Apple Pay session starts
onSessionEndedFired when the Apple Pay session ends

PaymentSubmitResponse

Passed to the onSuccess callback on successful payment:

interface PaymentSubmitResponse {
  paymentMethod: string;
  transactionId: string;
  status: 'SUCCESS';
}

PaymentSubmitError

Passed to the onError callback when a payment fails:

interface PaymentSubmitError {
  code: string;
  message: string;
  transactionId?: string;
  redirectHtml?: string; // 3DS redirect HTML (if applicable)
}

Methods

// Check if Apple Pay is available
const available = await applePay.canMakePayments();

// Initiate Apple Pay payment
const result = await applePay.createPaymentMethod();