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.

useMoonPay() returns the SDK client made available by <MoonPayProvider>. Call it from any function component below the provider to access integration methods.
ConnectScreen.tsx
import { useMoonPay } from "@moonpay/platform-sdk-react-native";

export function ConnectScreen() {
  const { client } = useMoonPay();

  const handleConnect = async () => {
    const result = await client.getConnection();
    if (!result.ok) {
      console.error(result.error.message);
      return;
    }
    console.log(result.value);
  };

  // ...
}

Return value

useMoonPay() returns an object with a single client property. The client exposes every integration method — see the MoonPayProvider reference for the full list.
FieldTypeRequiredDescription
clientobjectThe SDK client used to call MoonPay Platform methods.

Errors

useMoonPay() throws if called outside a <MoonPayProvider>:
useMoonPay must be used within a <MoonPayProvider>
Mount the provider higher in the tree, or call the hook from a child of the provider.