Render the Add Card frame in your app so the customer can save a new credit or debit card. Card data is captured inside a PCI-compliant MoonPay-hosted UI rendered in aDocumentation Index
Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
Use this file to discover all available pages before exploring further.
react-native-webview and never touches your app code.
Unlike the Apple Pay and Google Pay frames, the Add Card frame does not emit a
ready event. The card form renders immediately when the frame is set up.Setup Add Card
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
onEvent | (event: AddCardEvent) => void | Callback invoked for Add Card flow events. See AddCardEvent. |
AddCardEvent
onEvent receives events as the Add Card flow progresses. Use event.kind to
decide how to handle each event.
| kind | Payload | When you receive it |
|---|---|---|
"complete" | { card: CardResponse } | The card was saved successfully. |
"error" | AddCardEventError | The flow encountered an error. |
ready event — the card form is visible as
soon as the frame is set up.
CardResponse
The card object returned when the customer finishes adding a card. Use id
directly in getQuote — there
is no need to re-fetch payment methods.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | The stored card identifier. |
type | string | ✅ | The payment method type, typically "card". |
cardType | string | ✅ | The card sub-type (for example, "credit" or "debit"). |
brand | string | ✅ | The card network brand (for example, "visa", "mastercard"). |
last4 | string | ✅ | The last four digits of the card number. |
expirationMonth | string | ✅ | The card expiration month, as a two-digit string (for example, "04"). |
expirationYear | string | ✅ | The card expiration year, as a four-digit string (for example, "2030"). |
availability | { active: true } | ✅ | The card is available for new transactions when the frame returns it. |
AddCardEventError
| Field | Type | Required | Description |
|---|---|---|---|
code | "configurationError" | "generic" | ✅ | The error category. |
message | string | ✅ | Developer-friendly details. |
Result
client.setupAddCard() returns a Result<AddCardFrame, SetupAddCardError>.
Result envelope
Result<AddCardFrame, SetupAddCardError>
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | ✅ | Whether the operation succeeded. |
value | AddCardFrame | Present when ok is true. | |
error | SetupAddCardError | Present when ok is false. |
AddCardFrame
| Field | Type | Required | Description |
|---|---|---|---|
dispose | () => void | ✅ | Unmounts the frame. After you call this, no further events are dispatched to your onEvent callback. |
setQuote method — quotes are issued
after the card is saved.
SetupAddCardError
| Field | Type | Required | Description |
|---|---|---|---|
kind | "configurationError" | "genericError" | ✅ | The error category. |
message | string | ✅ | Developer-friendly details. |
Example: Add a card, then buy
After thecomplete event fires, pass card.id to
getQuote and use the returned
signature with setupBuy to
execute the transaction. For the full end-to-end walkthrough, see the Pay with
card guide.
Add card, then buy
TS Definitions
TS Definitions
types.ts