<MoonPayProvider> initializes the SDK with a sessionToken and renders MoonPay frames as react-native-webview instances when you call SDK methods. Wrap the part of your app that needs access to the client.
App.tsx
useMoonPay().
Props
Providing the session token later
ThesessionToken prop is optional. If you don’t have the token when the provider mounts — for example, you fetch it from your server after the customer signs in — mount <MoonPayProvider> without it and call initialize() once the token is available.
App.tsx
SignInScreen.tsx
isInitialized rather than calling a method on a client you captured before initialize(). Calling a connection method before a token is set returns an err() result.
If you pass the
sessionToken prop and also call initialize(), the prop
wins — pick one approach. Calling initialize() again replaces the token (for
example, after a refresh or when switching accounts) and clears any
credentials cached from the previous session.Frame rendering
When you call a method that opens a visible frame — such asclient.connect(),
client.setupWidget(), or client.setupAddCard() — the provider presents it
in a full-screen native Modal with a slide animation. Multiple frames stack
naturally: for example, a challenge frame appears on top of an active widget.
On Android, the hardware back button dismisses the top frame and disposes it.
Hidden utility frames (used by client.getConnection(), client.setupBuy(),
and client.resetConnection()) render as zero-size siblings with no visible
impact on your layout.
Layout
Client methods
The hook exposes aclient object with every integration method: