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 🙏

© 2025 – Pkg Stats / Ryan Hefner

easymerchantsdk-react-native

v1.0.1

Published

To implement the EasyMerchantSdk in your React Native App project. Follow the below steps:

Readme

EasyMerchantSdk React Native Implementation

To implement the EasyMerchantSdk in your React Native App project. Follow the below steps:

Add the sdk path in your project.

To add the path of sdk in your project. Open your package.json file and inside the dependencies section, add the below code and set the path of the sdk where you store on your disk.

"dependencies": {
...
  "easymerchantsdk-react-native": "^1.0.1"
},

or using command

npm i easymerchantsdk-react-native

Changes in android side.

Now open your android folder and there is a build.gradle file. Open it and add the below code in it.

allprojects {
    repositories {
                google()
                mavenCentral()
                maven { url 'https://jitpack.io' }
                maven {
                    url = uri("https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android")
                    credentials {
                        username = "EasyMerchant"
                        password = "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"
                    }
                }
            }
    }

Changes in IOS side.

Add below content inside the AppDelegate.swift File :-

Create a new file named AppDelegate.swift

import UIKit
import easymerchantsdk
import React

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        let jsCodeLocation: URL

        #if DEBUG
        jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")!
        #else
        jsCodeLocation = Bundle.main.url(forResource: "main", withExtension: "jsbundle")!
        #endif

        let bridge = RCTBridge(
            bundleURL: jsCodeLocation,
            moduleProvider: nil,
            launchOptions: launchOptions
        )

        guard let validBridge = bridge else {
            fatalError("React Native bridge failed to initialize.")
        }

        let rootView = RCTRootView(
            bridge: validBridge,
            moduleName: "EasyMerchantTestApp",    // replace it with your app name
            initialProperties: nil
        )

        self.window = UIWindow(frame: UIScreen.main.bounds)
        let rootViewController = UIViewController()
        rootViewController.view = rootView
        self.window?.rootViewController = rootViewController
        self.window?.makeKeyAndVisible()
      
      if let easyMerchantSdkPlugin = bridge?.module(for: EasyMerchantSdkPlugin.self) as? EasyMerchantSdkPlugin {
            easyMerchantSdkPlugin.setViewController(rootViewController)
        } else {
            print("Failed to retrieve EasyMerchantSdkPlugin instance from React Native bridge.")
        }
        return true
    }
}

inside the PodFile add below


  require_relative '../node_modules/react-native/scripts/react_native_pods'
  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

  platform :ios, 16.0
  
  pod 'easymerchantsdk', :path => '../node_modules/easymerchantsdk-react-native/ios'

How to call the sdk in App.js.

you can call the sdk using below example:


import React, { useState, useEffect } from 'react';

import { View, Text, Button, StyleSheet, NativeModules, Platform } from 'react-native';

const { RNEasymerchantsdk, EasyMerchantSdk } = NativeModules;

const App = () => {
const [version, setVersion] = useState('');
const [paymentResponse, setPaymentResponse] = useState('');
const [billingResult, setBillingResult] = useState('');

const getPlatformVersion = async () => {
try {
if (Platform.OS === 'android') {
const platformVersion = await RNEasymerchantsdk.platformVersion();
setVersion(platformVersion);
} else if (Platform.OS === 'ios') {
const version = await EasyMerchantSdk.getPlatformVersion();
setVersion(version);
}
} catch (error) {
setVersion('Error fetching version');
}
};

const handleBilling = async () => {
const amount = '100';
const additionalInfoRequest = {
name: "Test User",
email: "[email protected]",
phone_number: "9465351125",
country_code: "91",
description: "Test"
};

    const json = {
      address: "Mohali, Punjab",
      country: "India",
      state: "Punjab",
      city: "Anandpur Sahib",
      postal_code: "140118",
      additional_info: additionalInfoRequest
    };

    const jsonString = JSON.stringify(json);

    try {
      if (Platform.OS === 'android') {
        const response = await RNEasymerchantsdk.billing(amount, null);
        setPaymentResponse(`Payment Success: ${response}`);
      } else if (Platform.OS === 'ios') {
        const result = await EasyMerchantSdk.billing(amount, jsonString);
        setBillingResult(`Billing Success: ${result}`);
      }
    } catch (error) {
      if (Platform.OS === 'android') {
        setPaymentResponse(`Payment Error: ${error}`);
      } else if (Platform.OS === 'ios') {
        setBillingResult(`Billing Error: ${error.message || error}`);
      }
    }
};

useEffect(() => {
if (Platform.OS === 'ios') {
const initializeViewController = async () => {
if (EasyMerchantSdk && EasyMerchantSdk.setViewController) {
try {
await EasyMerchantSdk.setViewController();
console.log('ViewController set successfully');
} catch (error) {
console.error('Error setting ViewController:', error.message || error);
}
} else {
console.warn('EasyMerchantSdk.setViewController is not available');
}
};

      initializeViewController();
    }
}, []);

return (
<View style={styles.container}>
<Text>Platform Version: {version}</Text>
<Button title="Get Platform Version" onPress={getPlatformVersion} />

      <Button title="Make Payment" onPress={handleBilling} />

      {paymentResponse && <Text>{paymentResponse}</Text>}
      {billingResult && <Text>{billingResult}</Text>}
    </View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 20,
},
});

export default App;

You can send null if billing info not available.