Skip to main content
Use this guide to render the MoonPay buy widget after you have a connected customer. The widget renders the full MoonPay buy experience — including payment collection and transaction confirmation — inside an iframe in your application. It supports all payment methods and regions available in the standard MoonPay integration.

Prerequisites

  • A connected customer (via client.getConnection() or client.connect()).
  • A UI surface where you can render the widget frame (for example, a modal or full-screen container).

Get a quote

Request a quote for the transaction. The widget requires an executable quote, so pass both a wallet and a paymentMethod. A quote that is not executable will not render in the widget.
Get quote
For the current list of supported paymentMethod.type values, see the Get a quote API reference, which renders the enum from the live OpenAPI spec. The widget collects payment for the method in the quote: apple_pay renders Apple Pay, including in browsers the headless Apple Pay flow doesn’t support. In those browsers, the customer approves the payment by scanning a QR code with their iPhone.

Render the widget

Pass the quote signature to setupWidget. The widget handles the entire purchase flow inside the iframe.
Widget

Transaction statuses

  • waitingAuthorization: The transaction has been created but the customer needs to complete an authorization step (for example, 3-D Secure).
  • Pending: The payment has been accepted and the assets are being transferred.
  • Complete: The transaction is finalized and the assets have been delivered.
  • Failed: The transaction has failed. No payment was applied.

Compare payment methods

The widget is one of five ways to run a buy. See Choose a payment method to compare it with Apple Pay, Google Pay, card, and the buy button. Use getPaymentMethods() to determine which methods are available and choose the flow that fits your experience.