Code Monkey home page Code Monkey logo

ec-react-native-library's Introduction

@juspay/ec-react-native-library integration

This is react-native library for Juspay's Express Checkout SDK. For installing it to your project. Follow the below steps.

Installation

npm install @juspay/ec-react-native-library --save

// Required only if react-native version is below 0.60.0
react-native link @juspay/ec-react-native-library

Android

Add below maven url to your app/build.gradle

    maven {
        url "https://maven.juspay.in/jp-build-packages/hyper-sdk/"
    }

(Optional) Add the following ext properties in root build.gradle if you want to override either of the base SDK versions present in plugin:

buildscript {
  ....
   ext {
       ....
       hyperSDKVersion = "2.0.2-rc.65"
       hyperWrapperVersion = "2.0.0-19"
       ....
   }
   ....
}

Note: These versions are just for explanatory purposes and may change in future. Contact Juspay support team for the latest SDK versions.

iOS

Run the following command inside the ios folder of your react native project:

pod install

Usage

import EcReactNativeLibrary from '@juspay/ec-react-native-library';

var nbPayload = {
                  opName: "nbTxn",
                  paymentMethodType: "NB",
                  paymentMethod: "enter bank code", // 
                  redirectAfterPayment: "true",
                  format: "json"
                }
//Here payload format is specified for netbanking transaction. For different types of payload types 
//for other operations, refer https://developer.juspay.in/docs/expresscheckout-sdk


var requestPayload = {
                baseParams: {
                  merchant_id: "pass merchant id",
                  client_id: "pass client id",
                  transaction_id: "pass transaction id", //optional
                  order_id: "pass order id",
                  amount: "amount", //eg: "1.00"
                  customer_id : "pass customer id",
                  customer_email : "pass email",
                  customer_phone_number : "pass phone number",
                  environment: "pass environment" eg: "sandbox" or "prod"
                },
                serviceParams: {
                  service: "in.juspay.ec",
                  session_token: "pass client auth token",
                  endUrls: [], //eg: ["https://www.reload.in/recharge/", ".*www.reload.in/payment/f.*"]
                  payload: JSON.stringify(nbPayload) 
                },
                customParams: {} //customParams are optional key value pairs. 
              }
              EcReactNativeLibrary.startPayment( 
                  JSON.stringify(requestPayload), 
                  (successResponse) => {
                    console.log(successResponse);
                  },
                  (errorResponse) => {
                    console.log(errorResponse);
                  } 
              );

ec-react-native-library's People

Contributors

balaganesh-juspay avatar bosantomali avatar jamesgeorg avatar kiranpuppala avatar kiranpuppala-juspay avatar mvms1994 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ec-react-native-library's Issues

Android library name change request

Can you change your android library name to something related to your organization name from com.reactlibrary, this is very common name you should not use this name. It will cause conflict in many projects.

Documentation Missing

Please add the link for documentation. Also, update what functions are exposed by this SDK

Why do I get this error when I start a payment using react-native juspay?

I am implementing a juspay payment gateway in react-native in this code. I am getting the following error:

attempt to invoke the virtual method 'java.lang.String org.json.JSONObject.toString()' on a null object reference in react native

Here is the code it should open the payment page, but it gives an error. Please help me.

import EcReactNativeLibrary from '@juspay/ec-react-native-library';

var nbPayload = {
opName: "nbTxn",
paymentMethodType: "NB",
paymentMethod: "enter bank code", //
redirectAfterPayment: "true",
format: "json"
}
//Here payload format is specified for netbanking transaction. For different types of payload types
//for other operations, refer https://developer.juspay.in/docs/expresscheckout-sdk

var requestPayload = {
baseParams: {
merchant_id: "my-merchant-id-test",
client_id: ""sgsjjvxbhwu15shq67161",
order_id: "272682162817218727",
amount: "1.00", //eg: "1.00"
customer_id : "pass customer id",
customer_email : "[email protected]",
customer_phone_number : "80xxxxxxxx",
environment: "sandbox"
},
serviceParams: {
service: "in.juspay.ec",
session_token: "pass client auth token",
endUrls: ['https://www.reload.in/recharge/'],
payload: nbPayload
},

          }
          EcReactNativeLibrary.startPayment( 
              JSON.stringify(requestPayload), 
              (successResponse) => {
                console.log(successResponse);
              },
              (errorResponse) => {
                console.log(errorResponse);
              } 
          );

errorMessage":"[merchantAccount] cannot be null

I've integrated everything according to the docs but I get a success response saying 'errorMessage":"[merchantAccount] cannot be null'.

let nbPayload = {
opName: 'nbTxn',
paymentMethodType:'NB',
paymentMethod:'NB_SBI',
redirectAfterPayment: 'true',
format: 'json',
};
//Here payload format is specified for netbanking transaction. For different types of payload types
//for other operations, refer https://developer.juspay.in/docs/expresscheckout-sdk

let requestPayload = {
baseParams: {
merchant_id: 'My merchant Id,
client_id: 'merchantId_android',
order_id:'12344',
amount: '10', //eg: "1.00"
customer_id: 'ABC_123',
customer_email: '[email protected]',
customer_phone_number: '78XXXXXXXX',
environment: 'sandbox',
},
serviceParams: {
service: 'in.juspay.ec',
session_token: 'pass client auth token',
endUrls: [], //eg: ["https://www.reload.in/recharge/", ".www.reload.in/payment/f."]
payload: nbPayload,
},
customParams: {}, //customParams are optional key value pairs.
};

EcReactNativeLibrary.startPayment(
JSON.stringify(requestPayload),
(successResponse) => {
console.log(successResponse, 'success');
},
(errorResponse) => {
console.log(errorResponse, 'error');
},
);

HyperSDK pod symbol name conflict with another framework

Your framework PWAINSilentPayIOSSDK have 16 symbol name conflict with PayWithAmazon framework. Can you update those name:

duplicate symbol '_METRICS_COUNT_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol '_PUBLISH_IN_MS_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol '_LOGS_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol '_TIMES_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol '_TIME_METRICS_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol '_METRICS_OPERATION_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(RecordsPublisher.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINRecordsPublisher.o)
duplicate symbol 'OBJC_CLASS$_EnumUtils' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(EnumUtils.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(EnumUtils.o)
duplicate symbol 'OBJC_METACLASS$_EnumUtils' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(EnumUtils.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(EnumUtils.o)
duplicate symbol '_PWAIN_CONFIG_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol '_PWAIN_CONFIG_SHARED_PREF_KEY' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol '_PWAIN_CHARACTER_LIMIT' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol '_PWAIN_ERROR_DOMAIN' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol '_PWAIN_AMAZON_BACKEND_METRICS_ENDPOINT_METHOD' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol '_PWAIN_AMAZON_BACKEND_DYNAMIC_CONFIG_ENDPOINT_METHOD' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(SilentPayConstants.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(PWAINConstants.o)
duplicate symbol 'OBJC_CLASS$_AMZGzipUtility' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(AMZGzipUtility.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(AMZGzipUtility.o)
duplicate symbol 'OBJC_METACLASS$_AMZGzipUtility' in:
Pods/HyperSDK/PWAINSilentPayiOSSDK.framework/PWAINSilentPayiOSSDK(AMZGzipUtility.o)
Amazonpay/PayWithAmazon.framework/PayWithAmazon(AMZGzipUtility.o)

Not able to run in android after installation

After follows, installation guidelines am not able to run the code in android. Am getting following error

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find in.juspay:godel-ec:1.0.7.12.
Searched in the following locations:
- file:/home/tanmay/.m2/repository/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.pom
- file:/home/tanmay/.m2/repository/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.jar
- file:/home/tanmay/Documents/React Native app/AwesomeProject/node_modules/react-native/android/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.pom
- file:/home/tanmay/Documents/React Native app/AwesomeProject/node_modules/react-native/android/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.jar
- file:/home/tanmay/Documents/React Native app/AwesomeProject/node_modules/jsc-android/dist/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.pom
- file:/home/tanmay/Documents/React Native app/AwesomeProject/node_modules/jsc-android/dist/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.jar
- https://dl.google.com/dl/android/maven2/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.pom
- https://dl.google.com/dl/android/maven2/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.jar
- https://jcenter.bintray.com/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.pom
- https://jcenter.bintray.com/in/juspay/godel-ec/1.0.7.12/godel-ec-1.0.7.12.jar
Required by:
project :app > project :@juspay_ec-react-native-library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.