在将 payumoney 集成到 react-native 中时,我收到此错误 [TypeError: null is not an object (evaluating 'RNPayumoney.pay')]

问题描述

import React,{Fragment,useState} from 'react';

从'react-native-payumoney'导入Payumoney,{HashGenerator}; 从'react-native'导入{视图、按钮、文本};

const PaymentScreen = () => { const [paymentStatus,setPaymentStatus] = useState("");

让 x= HashGenerator({ // key: "F1kPQy9G",键:'QylhKRVd', 金额:“10.0”, 电子邮件:“[email protected]”, txnId: "1594976828726",产品名称:“产品信息”, firstName: "名字",//盐:“y5iZUCzqmP”, 盐:“seVTUgzrgE”, }); console.log (x);

const pay = async () => {
    setPaymentStatus("");
    const payData = {
        amount: '10.0',txnId: '1594976828726',productName: 'product_info',firstName: 'firstname',email: '[email protected]',phone: '9954546495',// merchantId: '7355228',merchantId: '5960507',// key: 'F1kPQy9G',key: 'QylhKRVd',successUrl: 'https://www.payumoney.com/mobileapp/payumoney/success.PHP',FailedUrl: 'https://www.payumoney.com/mobileapp/payumoney/failure.PHP',isDebug: true,hash: x,};
    Payumoney(payData).then((data) => {
        setPaymentStatus("Success");
       // console.log(data)
    }).catch((e) => {
        setPaymentStatus("Failed");
        console.log(e)
    })
};

return (
    <Fragment>
        <View
            style={{
                flex: 1,alignItems: 'center',justifyContent: 'center',height: 200,}}
        >
            <Button
                onPress={() => pay()}
                title='Pay me :'
            />
            <Text>{paymentStatus}</Text>
        </View>
    </Fragment>
)

}

导出认支付屏幕;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)