> ## Documentation Index
> Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# <MoonPayBuyButton />

> Inline card buy button. Render it wherever it should appear in your layout.

`<MoonPayBuyButton>` renders a card payment button inline in your layout. It
is the declarative alternative to
[`client.setupBuyButton()`](/platform/sdk-reference/react-native/setup-buy-button).

```tsx BuyButtonSection.tsx theme={null}
import React from "react";
import {
  MoonPayBuyButton,
  MoonPayChallenge,
  type BuyButtonEvent,
} from "@moonpay/platform-sdk-react-native";

export function BuyButtonSection({
  quoteSignature,
}: {
  quoteSignature: string;
}) {
  const [challengeUrl, setChallengeUrl] = React.useState<string | null>(null);

  const handleEvent = (event: BuyButtonEvent) => {
    switch (event.kind) {
      case "complete":
        console.log(event.payload.transaction);
        break;
      case "challenge":
        setChallengeUrl(event.payload.url);
        break;
      case "error":
        console.error(event.payload.code, event.payload.message);
        break;
    }
  };

  return (
    <>
      <MoonPayBuyButton quote={quoteSignature} onEvent={handleEvent} />
      {challengeUrl && (
        <MoonPayChallenge
          url={challengeUrl}
          onEvent={(e) => {
            if (e.kind === "complete" || e.kind === "cancelled") {
              setChallengeUrl(null);
            }
          }}
        />
      )}
    </>
  );
}
```

***

## Props

| Prop      | Type                              | Required | Default      | Description                                                                                                                                                                     |
| --------- | --------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `quote`   | `string`                          | ✅        | —            | Quote `signature` from [`getQuote()`](/platform/sdk-reference/react-native/get-quote). Reactive — updating this prop pushes the new signature into the frame without a remount. |
| `onEvent` | `(event: BuyButtonEvent) => void` |          | —            | Callback for buy button lifecycle events. See [`BuyButtonEvent`](#buybuttonevent).                                                                                              |
| `style`   | `ViewStyle`                       |          | `height: 48` | Container style.                                                                                                                                                                |

### `BuyButtonEvent`

Use `event.kind` to handle each event.

| kind          | Payload                             | When you receive it                                                                                                                            |
| ------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `"complete"`  | `{ transaction: FrameTransaction }` | The payment finished. Inspect `FrameTransaction` for the outcome.                                                                              |
| `"challenge"` | `{ kind: "frame"; url: string }`    | Verification required. Render [`<MoonPayChallenge>`](/platform/sdk-reference/react-native/components/moonpay-challenge) with the provided URL. |
| `"error"`     | `{ code: string; message: string }` | The flow encountered an error.                                                                                                                 |

When the quote expires, the frame emits an `"error"` event with
`code: "quoteExpired"`. Fetch a new quote and update the `quote` prop to retry.
