Skip to main content

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.

The React Native SDK wraps the MoonPay Developer Platform in a <MoonPayProvider> and a useMoonPay() hook. Frames render as native react-native-webview instances managed by the provider. The SDK ships with TypeScript types for autocomplete and inference. The SDK is tested against:
  • React Native 0.73+
  • React 18.2+
  • react-native-webview 13.0+
  • iOS 14+ and Android API 26+

Install

Install the SDK package and its peer dependency:
pnpm i @moonpay/platform-sdk-react-native react-native-webview
Follow the react-native-webview install guide to link the native module. On iOS, run pod install from your ios/ directory.

Conventions

Provider + hook

Mount <MoonPayProvider> near the top of your app tree and call useMoonPay() from any descendant component to get the client. The provider renders frames automatically as siblings of its children when you call methods such as client.connect() or client.setupWidget().
App.tsx
import { MoonPayProvider } from "@moonpay/platform-sdk-react-native";

export default function App() {
  return (
    <MoonPayProvider sessionToken="c3N0XzAwMQ==">
      <YourApp />
    </MoonPayProvider>
  );
}

Result<T, E>

Most SDK functions return a Result<T, E> instead of throwing.
FieldTypeRequiredDescription
okbooleanWhether the operation succeeded.
valueTPresent when ok is true.
errorEPresent when ok is false.
Use this pattern to branch on success vs failure:
const result = await client.getConnection();

if (!result.ok) {
  // Handle error
  console.error(result.error);
  return;
}

console.log(result.value);

Function reference

These pages document the provider, hook, and individual SDK functions:

Mount the provider

Access the client with useMoonPay()

Check the customer's connection

Connect a customer

Reset the customer's connection

List payment methods

Get a quote

Set up Apple Pay

Set up Google Pay

Set up the widget

Set up the buy frame

Set up the buy button

Add a card

Set up the Challenge frame

Get a transaction

List transactions

Delete a payment method