client.setupGooglePay() is deprecated. Use
client.setupBuyButton()
instead. For a Google Pay quote, it renders the Google Pay button and accepts
the same googlePayButtonSettings. It reports an expired quote as an
"error" with code quoteExpired, and Google Pay being unavailable as an
"error" with code googlePayUnavailable. Existing setupGooglePay() calls
keep working. Build new integrations with setupBuyButton().executable: true.
To let new customers buy with Google Pay before they have a MoonPay account, see
Guest checkout. The guest checkout guide uses
setupBuyButton(), which renders the same button. 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 failureCode and 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