juspay / juspay/ec-react-native-library

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

Open
#7 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1
Forks
9
PR merge metrics
No merged PRs in 30d

Description

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 : "pintu0002@gmail.com",
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);
}
);

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.