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

2.0.1 • Public • Published

Transak React Native SDK

A React Native SDK for decentralised applications to onboard their global user base with fiat currency.

Installation

npm i @transak/react-native-sdk

Install these required peer dependencies to facilitate auto-linking.

npm i react-native-webview
npm i react-native-inappbrowser-reborn
npm i @react-native-community/netinfo

Example usage

import { TransakWebView, Environments, Events, TransakConfig, EventTypes, Order } from '@transak/react-native-sdk';

function TransakWebViewIntegration() {
  const transakConfig: TransakConfig = {
    apiKey: '<your-api-key>', // (Required)
    environment: Environments.STAGING/Environments.PRODUCTION, // (Required)
    // .....
    // For the full list of query params refer Props section below
  };
  const onTransakEventHandler = (event: EventTypes, data: Order) => {
    switch(event) {
      case Events.ORDER_CREATED:
        console.log(event, data);
        break;

      case Events.ORDER_PROCESSING:
        console.log(event, data);
        break;

      case Events.ORDER_COMPLETED:
        console.log(event, data);
        break;

      default:
        console.log(event, data);
    }
  };

  return (
    <TransakWebView
      transakConfig={transakConfig}
      onTransakEvent={onTransakEventHandler}
      // .....
      // For the full list of react-native-webview props refer Props section below
    />
  );
}

Props

Prop Description
transakConfig Refer here for the full list of customisation options
onTransakEvent Callback function to listen to order related events

This component accepts most of the [react-native-webview props](https://github.com/react-native-webview/react-native-webview/blob/HEAD/docs/Reference.md), except the following: sharedCookiesEnabled, injectedJavaScript, injectedJavaScriptBeforeContentLoaded

License

ISC Licensed. Copyright (c) 2023 Transak Inc.

/@transak/react-native-sdk/

    Package Sidebar

    Install

    npm i @transak/react-native-sdk

    Weekly Downloads

    211

    Version

    2.0.1

    License

    ISC

    Unpacked Size

    38.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • transakgs
    • aditya1910
    • kutsav
    • sshandilya
    • yeshuagarwal