Skip to main content
<MoonPayAuth> renders the MoonPay auth frame inline in your layout. It is the declarative alternative to client.setupAuth(). The auth frame is a lighter-weight counterpart to the connect flow. It drives the customer through email/OTP authentication only, without the full connect UI. This makes it a good fit for headless and Customer API integrations. Precondition: a clientToken must be present in the client context before mounting this component. The token is populated automatically when client.getConnection() or <MoonPayConnectionCheck> resolves with status: "connectionRequired". If no token is present, the component emits an "error" event. When the customer completes the flow with an active connection, credentials are decrypted and stored on the shared client automatically.
AuthScreen.tsx

Props

AuthEvent

Use event.kind to handle each event. ConnectionError is discriminated by code: ConfigValidationFieldError entries have code: "invalidSessionToken" | "invalidClientToken" | "invalidPublicKey" and a developer-facing message.
"complete" is emitted only for active and termsAcceptanceRequired connection statuses. If the customer’s connection resolves to another status (such as pending or unavailable), no "complete" event fires.