@moonpay/react-native-moonpay-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

@moonpay/react-native-moonpay-sdk

The MoonPay React Native SDK enables you to integrate the MoonPay widget so you can facilitate crypto purchases within your platform.

Documentation

For detailed integration instructions and further documentation, please visit our Documentation Site.

Installation

To install the package, use npm or yarn:

npm install --save @moonpay/react-native-moonpay-sdk

or

yarn add @moonpay/react-native-moonpay-sdk

Prerequisites

Before using this package, make sure you have the following:

  • An active MoonPay account.
  • Your MoonPay API key.

Usage

  1. Import the useMoonPaySdk hook in you React Native component
import { useMoonPaySdk } from '@moonpay/react-native-moonpay-sdk';
  1. Invoke the hook with the passed configuration object

If you want to display the widget in a WebView:

const { MoonPayWebViewComponent } = useMoonPaySdk({
  sdkConfig: {
    flow: 'buy',
    environment: 'sandbox',
    params: {
      apiKey: 'pk_test_123',
    },
  },
});

return (
  <View>
    <MoonPayWebViewComponent />
  </View>
);

If you want to display the widget in an In-App browser

const { openWithInAppBrowser } = useMoonPaySdk({
  sdkConfig: {
    flow: 'buy',
    environment: 'sandbox',
    params: {
      apiKey: 'pk_test_123',
    },
  },
});

return (
  <View>
    <Button onPress={openWithInAppBrowser} />
  </View>
);

Package Sidebar

Install

npm i @moonpay/react-native-moonpay-sdk

Weekly Downloads

107

Version

0.9.0

License

MIT

Unpacked Size

177 kB

Total Files

6

Last publish

Collaborators

  • moonpay-engineering
  • moonpay-security
  • sbsto
  • ihell
  • tomislavhrenmp
  • npmitservices
  • jpulsifer-moonpay
  • vfaramond