1
votes

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'))

1
I am also getting same errorSatish Lodhi
you can implement the upi payment after ejecting from expovjeet

1 Answers

0
votes

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