reactjs - Cashfree 支付网关集成在 react native 和 laravel 中(orderAmount 是必需的错误)
问题描述
我正在将 CashFree 支付网关集成到 react 本机应用程序(Android)中。我正在关注此文档https://docs.cashfree.com/docs/react-native-2-0-sdk#web-checkout。在实施时,我得到了回应
{"type":"CashFreeResponse","txMsg":"orderAmount not provided","txStatus":"FAILED"}
但是我正在传递所有需要进行付款的参数。
const handlePayment = response => {
console.log('amount', total);
var mode = 'TEST';
var map = {
"appId": response.credentials.app_id,
"orderId": response.credentials.order_id,
"orderCurrency": 'INR',
"orderAmount": 150, //parseInt(response.data.price)
"customerPhone": response.user.mobile,
"customerEmail": response.user.email,
"tokenData": response.payment_info.cftoken,
"orderNote": 'Subscription Payment',
"notifyUrl": '',
"customerName": response.user.name,
};
console.log('data', map);
RNPgReactNativeSDK.startPaymentWEB(map, mode, result => {
console.log(result);
var obj = JSON.parse(result, function (key, value) {
console.log(key + '::' + value);
// Do something with the result
});
});
};
解决方案
根据他们网站上提到的文档,您需要输入订单金额作为字符串。
const handlePayment = response => {
console.log('amount', total);
var mode = 'TEST';
var map = {
"appId": response.credentials.app_id,
"orderId": response.credentials.order_id,
"orderCurrency": 'INR',
"orderAmount": '150',
"customerPhone": response.user.mobile,
"customerEmail": response.user.email,
"tokenData": response.payment_info.cftoken,
"orderNote": 'Subscription Payment',
"notifyUrl": '',
"customerName": response.user.name,
};
console.log('data', map);
RNPgReactNativeSDK.startPaymentWEB(map, mode, result => {
console.log(result);
var obj = JSON.parse(result, function (key, value) {
console.log(key + '::' + value);
// Do something with the result
});
});
};
推荐阅读
- sql - 找不到。新的或正在进行的旅行实例
- javascript - 如何使用 javascript 对齐 excel 单元格中的文本?
- unity3d - unity mesh 有黑点
- .net - 停止矩形高度大小
- python - 如何在 django 模板(for 循环)和 jquery 中创建多个日期时间选择器
- html - 我应该如何以惯用的 React 方式访问自定义 HTML 组件的生成子项?
- django - 在 Docker 容器中努力解决 Django 和 Postgres 之间的连接问题
- java - JavaFX Animation Timer 类不以 60 fps 为上限
- javascript - 改变常量值的排序方法
- javascript - 根据 JavaScript 对象的键创建数组