Poko SDK for React Native

Parameters

Name
Required
Data type
Description

fiat

false

string

Fiat currency (USD, VND,..)

crypto

false

string

Follow this format: SYMBOL-network (eg: ETH-ethereum, USDT-bsc,..)

fiatAmount

false

number

Fiat amount. fiatAmount is prioritized over cryptoAmount

cryptoAmount

false

number

Crypto amount

strictMode

false

boolean

Do/Don’t allow user to change fiat/crypto

receiveWalletAddress

false

string

Receiving wallet address. If not provided, user will be asked to input wallet address

fiatList

false

string

Whitelist a list of fiat currencies to be displayed, separated by comma (VND,USD,AUD,..). Otherwise all supported fiat currencies will be displayed

cryptoList

false

string

Whitelist a list of cryptocurrencies to be displayed, separated by comma (ETH-ethereum,USDT-bsc,..). Otherwise all supported crypto will be displayed

excludeProviderIds

false

string

List of providers to be disabled. Supported providers are: transak, xanpool, onmeta, loopipay, fiahub, chainverse, payfura, onramp_money, transfi, moonpay, localram, sardine

signature

false

string

providerId

false

string

To open directly that provider instead of Poko's first screen

paymentMethodId

false

string

Use along with providerId.

Installation

npm install @pokopayment/react-native-sdk

The SDK needs 2 other packages to work correctly, follow these command to install them:

npm install react-native-webview

npm install react-native-permissions

Next, add the CAMERA permission to your application (See more here):

  • Android

Add this line to the AndroidManifest.xml

<uses-permission android:name="android.permission.CAMERA" />
  • iOS:

Install pod-install: npm install -D pod-install

Update your package.json

  "scripts": {
    ....
    "postinstall": "react-native setup-ios-permissions && pod-install"
  },
  "reactNativePermissionsIOS": [
    "Camera"
  ]

Then update your Info.plist with wanted permissions usage descriptions:json

  <key>NSCameraUsageDescription</key>
  <string>Some providers would need it for the KYC process</string>

Code Sample

// Root component
import {PokoWidgetProvider} from '@pokopayment/react-native-sdk';

function App(): JSX.Element {
  return (
    <PokoWidgetProvider apiKey="your API_KEY (optional)" environment="DEVELOPMENT (default) | STAGING | PRODUCTION">
      <HelloWorld />
    </PokoWidgetProvider>
  );
}

// HelloWorld component
import {usePokoWidget} from '@pokopayment/react-native-sdk';

const {launchWidget, setApiKey, setEnv, setUserId} =
    usePokoWidget();

setApiKey('YOUR API KEY'); // required, can ignore if already provided from the PokoWidgetProvider
setUserId('Your user ID'); // required
setEnv('PRODUCTION' | 'STAGING' | 'DEVELOPMENT'); // default DEVELOPMENT

const urlLaunched = launchWidget({
    fiat?: string; // VND, USD,..
    crypto?: string; // USDT-bsc, USDT-ethereum, BTC-bitcoin,...
    fiatAmount?: number; // 100.0
    cryptoAmount?: number; // 0.5
    strictMode?: boolean; // true | false (not allow users change fiat & crypto currency)
    fiatList?: string[]; // ['VND', 'USD']
    cryptoList?: string[]; // ['ETH-ethereum', 'BTC-bitcoin']
    excludeProviderIds?: string[]; // ['transak', 'payfura']
    signature?: string;
    providerId?: string;
    paymentMethodId?: string;
    receiveWalletAddress?: string;
});

Last updated