Razorpay 与 Ionic 4 的集成出现错误请求错误
Razorpay Integration with Ionic 4 getting Bad request error
我已经使用 razorpay-cordova 插件来执行 Rozar pay 的支付,但我收到了错误的请求 "The id provided does not exist"。但我正在使用我的测试密钥 ID,这是非常正确的。
payWithRozarPay(invoice: any) {
const options = {
description:
'Buy ' + invoice.coin_amount + ' amount credit for quicklegalsolutions',
currency: 'INR',
key: 'rzp_test_Qtzsbri8xV2oIa',
order_id: invoice.inv_code,
amount: invoice.amount * 100,
name: 'Quick Legal Solutions',
prefill: {
email: invoice.user.email,
contact: invoice.user.mobile,
name: invoice.user.name
},
theme: {
color: '#F37254'
}
};
console.log(options);
// tslint:disable-next-line: only-arrow-functions
const successCallback = function(success: any) {
alert('payment_id: ' + success.razorpay_payment_id);
console.log('payment_id: ' + success.razorpay_payment_id);
};
// tslint:disable-next-line: only-arrow-functions
const cancelCallback = function(error: any) {
alert(error.description + ' (Error ' + error.code + ')');
console.log(error);
};
RazorpayCheckout.on('payment.success', successCallback);
RazorpayCheckout.on('payment.cancel', cancelCallback);
RazorpayCheckout.open(options);
}
从描述中删除 'order_id: invoice.inv_code'
你是对的@sayak
实际上在字段 order_id
上,当您使用订单流从 razorpay api 生成新订单时使用的 ID /order
,
很可能您没有使用他们的订单流程,所以这就是为什么您发送的 id
在他们的记录中不存在的原因。
如果您使用他们的流程来管理订单,您应该发送在生成订单时收到的 order_id
我已经使用 razorpay-cordova 插件来执行 Rozar pay 的支付,但我收到了错误的请求 "The id provided does not exist"。但我正在使用我的测试密钥 ID,这是非常正确的。
payWithRozarPay(invoice: any) {
const options = {
description:
'Buy ' + invoice.coin_amount + ' amount credit for quicklegalsolutions',
currency: 'INR',
key: 'rzp_test_Qtzsbri8xV2oIa',
order_id: invoice.inv_code,
amount: invoice.amount * 100,
name: 'Quick Legal Solutions',
prefill: {
email: invoice.user.email,
contact: invoice.user.mobile,
name: invoice.user.name
},
theme: {
color: '#F37254'
}
};
console.log(options);
// tslint:disable-next-line: only-arrow-functions
const successCallback = function(success: any) {
alert('payment_id: ' + success.razorpay_payment_id);
console.log('payment_id: ' + success.razorpay_payment_id);
};
// tslint:disable-next-line: only-arrow-functions
const cancelCallback = function(error: any) {
alert(error.description + ' (Error ' + error.code + ')');
console.log(error);
};
RazorpayCheckout.on('payment.success', successCallback);
RazorpayCheckout.on('payment.cancel', cancelCallback);
RazorpayCheckout.open(options);
}
从描述中删除 'order_id: invoice.inv_code'
你是对的@sayak
实际上在字段 order_id
上,当您使用订单流从 razorpay api 生成新订单时使用的 ID /order
,
很可能您没有使用他们的订单流程,所以这就是为什么您发送的 id
在他们的记录中不存在的原因。
如果您使用他们的流程来管理订单,您应该发送在生成订单时收到的 order_id