<MoonPayChallenge> renders a 3DS or identity challenge frame inline in your
layout. It is the declarative alternative to
client.setupChallenge().
Mount this component when a payment frame (Apple Pay, Google Pay, buy button,
or buy frame) emits a "challenge" event. Pass the url from the event
payload directly. Unmounting the component disposes the frame and stops event
delivery.
PaymentScreen.tsx
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | ✅ | — | Full challenge URL from a payment frame’s "challenge" event. Mount-time only. |
onEvent | (event: ChallengeEvent) => void | — | Callback for challenge lifecycle events. See ChallengeEvent. | |
style | ViewStyle | flex: 1 | Container style. |
ChallengeEvent
Use event.kind to handle each event.
| kind | Payload | When you receive it |
|---|---|---|
"ready" | — | The challenge UI is rendered and ready. |
"complete" | CompleteResult | The challenge finished. See CompleteResult shape below. |
"cancelled" | Cancellation | The customer dismissed the challenge. See Cancellation below. |
"error" | { code: string; message: string } | The challenge encountered an error. |
CompleteResult is a discriminated union on flow:
flow | Extra fields |
|---|---|
"buy" | transaction: FrameTransaction |
"identity" | identityId: string |
Cancellation is a discriminated union on flow:
flow | Extra fields |
|---|---|
"buy" | transactionId?: string, challengeToken?: string |
"identity" | — |
"cancelled", carry transactionId and challengeToken to resume the
transaction if needed.