omnipay-reactnative-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

omnipay-reactnative-sdk

Omnipay react native sdk

Installation

yarn add omnipay-reactnative-sdk

Dependencies

yarn add react-native-select-contact react-native-webview react-native-share

Make sure your manifest files includes permission to read contacts

<uses-permission android:name="android.permission.READ_CONTACTS" />

Also add this for Android 11+ support below the application tag in your AndroidManifest.xml file

<application>
......
</application>
<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="vnd.android.cursor.dir/contact" />
    </intent>
</queries>

If using CocoaPods, in the ios/ run:

pod install

Please make sure AndroidX is enabled in your project by editting android/gradle.properties and adding 2 lines:

android.useAndroidX=true
android.enableJetifier=true

Usage

// usage with useOmnipay hook
import { OmnipayProvider, useOmnipay } from 'omnipay-reactnative-sdk';

// Wrap your parent component with OmnipayProvider like below
<OmnipayProvider
  publicKey="OMNIPUBKEY_HZA3ERGYEE5XUFGTZDQV_MNKRSTA3-TU"
  env="dev"
  color="red"
>
  {/* the rest of your app */}
</OmnipayProvider>;

// import useOmnipay hook in the component you need to show the bills or wallet sdk in
const { initiateBills, initiateWallet } = useOmnipay();

function onBillsClosed() {
  console.log('sdk is closed..you can do some stuff');
}

function onWalletClosed() {
  console.log('wallet is closed..you can do some stuff');
}

initiateBills({ phoneNumber: '08020001111', onClose: onBillsClosed });
initiateWallet({
  phoneNumber: '08020001111',
  customerRef: '9ab6790',
  userRef: '889huop',
  onClose: onWalletClosed,
  usesAirtimeData: true,
  usesBills: true,
  usesPaylater: true,
  usesPromo: true,
  usesPos: true,
  usesTransfer: true,
});

Properties

Name Type Description
color String color of primary buttons and links
env String dev or prod
phoneNumber String phone number of the customer
publicKey String public key of the company on omnipay
onClose Function this is used to notify you when the sdk closes
usesAirtimeData Boolean whether to show airtime and data shortcut in wallet view
usesBills Boolean whether to show bills shortcut in wallet view
usesPaylater Boolean whether to paylater tab in wallet view
usesPromo Boolean whether to show promo tab in wallet view
usesPos Boolean whether to pos shortcur in wallet view
usesTransfer Boolean whether to transfer shortcut in wallet view

Package Sidebar

Install

npm i omnipay-reactnative-sdk

Weekly Downloads

34

Version

1.0.4

License

MIT

Unpacked Size

125 kB

Total Files

45

Last publish

Collaborators

  • engrtitus