npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@onramp.money/onramp-react-native-sdk

v0.4.3

Published

React-Native SDK for Onramp payment gateway.

Downloads

284

Readme

@onramp.money/onramp-react-native-sdk

This is the React-Native SDK for Onramp payment gateway.

General Requirements

The minimum requirements for the SDK are:

  • iOS 12.0 and higher
  • Android minSdkVersion 21
  • Android compileSdkVersion 33

Installation

Installation with yarn

yarn add @onramp.money/onramp-react-native-sdk

iOS Extra Steps after installing

After the installation is complete, for iOS run:

npx pod-install

or

cd ios
pod install

Add LSApplicationQueriesSchemes

  • To allow your application to support UPI intent for Onramp, add the following code to enable UPI intents to the LSApplicationQueriesSchemes in the info.plist file of your project.
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>paytmmp</string>
        <string>gpay</string>
        <string>bhim</string>
        <string>upi</string>
        <string>phonepe</string>
        ...
    </array>
  • To allow your application to support Wallet Connect intent for Offramp, add the following code to enable WC intents to the LSApplicationQueriesSchemes in the info.plist file of your project.
    <key>LSApplicationQueriesSchemes</key>
    <array>
        ...
        <string>wc</string>
        <string>metamask</string>
        <string>trust</string>
        <string>safe</string>
        <string>rainbow</string>
        <string>uniswap</string>
        <string>zerion</string>
        <string>imtokenv2</string>
    </array>

Usage

Initialize the SDK

Add the following imports

import {startOnrampSDK, onRampSDKNativeEvent} from '@onramp.money/onramp-react-native-sdk';

Initialize the SDK by calling the startOnrampSDK function and pass the basic config parametes to start the sdk.

   startOnrampSDK({
       appId: 1, // replace this with the appID you got during onboarding
       walletAddress: '0x49...436B', // replace with user's wallet address
       flowType: 1 // 1 -> onramp || 2 -> offramp || 3 -> Merchant checkout
       fiatType: 1 // 1 -> INR || 2 -> TRY
       paymentMethod: 1 // 1 -> Instant transafer(UPI) || 2 -> Bank transfer(IMPS/FAST)
       // ... pass other configs here
   });

Listening to SDK Events

Add onRampSDKNativeEvent listener in your component where you've initialized the sdk.

 React.useEffect(() => {
   const onRampEventListener = onRampSDKNativeEvent.addListener(
     'widgetEvents',
     eventData => {
       // handle all the events here
       console.log('Received onRampEvent:', eventData);
     },
   );

   return () => {
     onRampEventListener.remove();
   };
 }, []);

About SDK Lifecycle

At any time, you can disable the sdk with the following code:

   closeOnrampSDK();

Initiate KYC SDK

Add the following imports

import { initiateOnrampKyc } from '@onramp.money/onramp-react-native-sdk';

To use the kyc widget, initialize the initiateOnrampKyc function and pass the kyc config parametes (mandatory) to start the sdk.

   initiateOnrampKyc({
     appId: 1, // replace this with the appID you got during onboarding
     payload: 'enter payload here',
     signature: 'enter signature here',
     customerId: 'enter customerId here',
     apiKey: 'enter apiKey here',
     lang:"en" // optional parameter, replace with desired language code
   });

Login SDK

Add the following imports

import { startOnrampLogin } from '@onramp.money/onramp-react-native-sdk';

To use the login widget, initialize the startOnrampLogin function and pass the login parameters (mandatory) to start the sdk.

   startOnrampLogin({
     appId: 1, // replace this with the appID you got during onboarding
     closeAfterLogin: true/false, // toggle this value based on if you want to close widget after login or not
     signature: "signature", // optional parameter
 	  phoneNumber: "+90-xxxxxxxxx", // optional parameter
     lang:"en" // optional parameter, replace with desired language code
   });

Events Docs

Here is the list of all events:

  • ONRAMP_WIDGET_READY -> sent when widget is ready for user interaction

  • ONRAMP_WIDGET_FAILED -> sent when widget render failed due to multiple reasons like wrong params combination or missing params etc.

  • ONRAMP_WIDGET_CONTENT_COPIED -> sent when copy to clipboard event is performed in widget, sends along the content copied.

  • ONRAMP_WIDGET_CLOSE_REQUEST_CONFIRMED -> sent when widget is closed

  • ONRAMP_WIDGET_CLOSE_REQUEST_CANCELLED -> sent when user dismisses close widget request modal.

  • ONRAMP_WIDGET_TX_INIT -> when user sees the payment details on screen

  • ONRAMP_WIDGET_TX_FINDING -> when user submits the reference number for INR deposit

  • ONRAMP_WIDGET_TX_PURCHASING -> when system finds the deposit against reference / UTR submitted by user

  • ONRAMP_WIDGET_TX_SENDING -> when system is done purchasing the crypto & starts withdrawal

  • ONRAMP_WIDGET_TX_COMPLETED -> when system gets the tx hash for the deposit

  • ONRAMP_WIDGET_TX_SENDING_FAILED -> if Failed before getting the tx hash

  • ONRAMP_WIDGET_TX_PURCHASING_FAILED -> if failed while making the crypto purchase

  • ONRAMP_WIDGET_TX_FINDING_FAILED -> if system failed at finding the deposit against the reference / UTR

License

MIT


Made with create-react-native-library