Let’s make it really short.
This write-up is all about adding a feature to our react-native app to call a UPI app so as to make payment and return back to our app after failure/success. This requires a dependency react-native-upi-payment.
Let’s start.
Install the dependency and link it. Open the project and type in :
npm install react-native-upi-payment
react-native link
That’s it. Now comes the usage. Import RNUpiPayment to the code and then :
RNUpiPayment.initializePayment({
vpa: 'someone@somewhere', // or can be john@ybl or mobileNo@upi
payeeName: 'Payee Name',
amount: '1',
transactionRef: 'some-random-id' },successCallback,failureCallback);//declare the functions successCallback and failureCallback to handle the response from the UPI application.
An example is given below :
I tried payment with Google Pay and its return value during success/failure is caught in the function failureCallback().
Thank you.