<MoonPayWidget> renders the MoonPay buy widget inline in your layout. It is
the declarative alternative to
client.setupWidget().
The widget presents the full buy flow — payment method selection, confirmation,
and transaction tracking — in a single embedded frame.
The
quote prop is mount-time only. Changing it after the component mounts
causes the widget to remount. If you need to update the quote without
remounting, use the headless
<MoonPayBuyFrame>
instead.WidgetScreen.tsx
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
quote | string | ✅ | — | Quote signature from getQuote(). Mount-time only — changing this prop remounts the widget. |
onEvent | (event: WidgetEvent) => void | — | Callback for widget lifecycle events. See WidgetEvent. | |
style | ViewStyle | flex: 1 | Container style. |
WidgetEvent
Use event.kind to handle each event.
| kind | Payload | When you receive it |
|---|---|---|
"ready" | — | The widget UI is rendered and ready. |
"transactionCreated" | { transaction: { id: string; status: string } } | A transaction was created. Use the id to track progress. |
"complete" | { transaction: FrameTransaction } | The widget flow finished. |
"close" | — | The customer closed the widget. |
"error" | { code: string; message: string } | The flow encountered an error. |
"error" codes: "configurationError" | "apiError" | "generic"