1

I want to add UPI payment in my App and currently using expo tool to create the app but now I got stuck as there is unable to find any direct implementation by using js only and require me to eject from expo. If there is any way by which I can implement the UPI without exiting from expo as it expo makes things really easy.

I have tried to implement the simple code provided in the docs for react-native-upi-payment but it is not moving ahead and require me to move through android manifest which is not inside the expo project.

import React from 'react'
import RNUpiPayment from 'react-native-upi-payment'
import { View, StyleSheet, Container } from 'react-native'
import { Input, Button } from 'react-native-elements'
import { Constants } from 'expo'

export default class PaymentScreen extends React.Component {

    static navigationOptions = {
            header: null
        }

    goToBhimUPI = () => {
        RNUpiPayment.initializePayment({
            vpa: 'someupi@ybl', // or can be john@ybl or mobileNo@upi
            payeeName: 'Name',
            amount: '1',
            transactionRef: 'some-random-id'
        }, this.successCallback, this.failureCallback);
    }

    failureCallback = (data) =>{
        console.log(data)
    }

    successCallback = (data) => {
        console.log(data)
    }

    render() {
        return(
            <Button
            containerStyle = {styles.button}
            type = 'clear'
            title = 'Bhim UPI'
            onPress = {this.goToBhimUPI}
            />
        )
    }
}

I expect this module to take me to the UPI payment gateway and return to the place from where it is called. Currently this is giving me error:(undefined is not an object(evaluating 'UpiModule.intializePayment'))

jeet
  • 107
  • 2
  • 17
  • I am also getting same error – Satish Lodhi Oct 20 '20 at 17:46
  • you can implement the upi payment after ejecting from expo – jeet Nov 01 '20 at 14:05
  • Hey @jeet, did you find any solution to make 'react-upi-payment' work with an expo driven react project? . i receive the same error as you have mentioned in the question. i would appreciate if you have any alternate solution. – Amit Apr 09 '22 at 05:58
  • you can checkout this https://github.com/hellochirag/react-native-GPay, if this helps as i didn't implemented for the upi payment for ios – jeet Apr 12 '22 at 18:39

1 Answers1

0

you can do this using react-native-upi-payment for all types of upi available or else phonepesdk for only phonepe integration

Vinil Prabhu
  • 1,279
  • 1
  • 10
  • 22
  • react-native-upi worked for android, is there anything i can go which helps me in implementing the payment system for android. – jeet Jun 26 '19 at 16:02
  • i didn't find any similar library for iOS, but you can try [react-native-upi](https://www.npmjs.com/package/react-native-upi) – Vinil Prabhu Jun 27 '19 at 04:14
  • 1
    yeah i'm trying to create a similar module provided in react-native-upi for iOS – jeet Jun 27 '19 at 09:40