Skip to main content
Render the Apple Pay frame into your UI and initiate a transaction with a quote signature. The quote must have executable: true.
Setup Apple Pay

Parameters

This method does not require a separate auth token. The client uses stored credentials from an active connection.

ApplePayEvent

onEvent receives events as the Apple Pay flow progresses. Use event.kind to decide how to handle each event.

FrameTransaction

The transaction object returned on "complete". FrameTransaction is a discriminated union — the failure variant carries failureReason, the non-failure variant always carries id.

ApplePayEventError

"oneTapApplePaySecondFactorRequired" is emitted on the 1TAP Apple Pay flow when MoonPay needs a second authentication factor — typically because the device is new or the customer hasn’t completed a recent challenge. Hand off to the full connect flow with client.connect(), then retry. Apple Pay being unavailable in the environment (for example, the browser doesn’t support it) is signalled separately through the "unsupported" event, not as an error.

Result

client.setupApplePay() returns a Result<ApplePayFrame, SetupApplePayError>.

Result envelope

Result<ApplePayFrame, SetupApplePayError>

ApplePayFrame

SetupApplePayError

Setup errors cover frame initialization only (for example, a handshake timeout). Quote problems, second-factor requirements, and Apple Pay availability are reported through onEvent after setup succeeds — as the "error", "quoteExpired", and "unsupported" events respectively.
types.ts