executable: true.
To let new customers buy with Google Pay before they have a MoonPay account, see
Guest checkout. Guest checkout uses the same
setupGooglePay call. Second-factor and KYC step-up arrive as a "challenge"
event.
Setup Google Pay
Parameters
This method does not require a separate auth token. The client uses stored credentials from an active connection, or from the connection check on guest checkout.
GooglePayEvent
onEvent receives events as the Google 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.
GooglePayEventError
Google Pay unavailability is signalled separately through the
"unsupported" event, not as an error.
Result
client.setupGooglePay() returns a Result<GooglePayFrame, SetupGooglePayError>.
Result envelope
Result<GooglePayFrame, SetupGooglePayError>
GooglePayFrame
SetupGooglePayError
Setup errors cover frame initialization only (for example, a handshake
timeout). Quote problems and Google Pay availability are reported through
onEvent after setup succeeds — as the "error", "quoteExpired", and
"unsupported" events respectively.
TS Definitions
TS Definitions
types.ts