简体   繁体   中英

How to Implement UPI Payment in my React-Native-App with Expo?

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

您可以使用react-native-upi-payment支持所有类型的upi,或者使用phonepesdk仅用于手机集成

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM