[英]How to create order_id on firebase for razorpay? I am using react-native with firebase for mobile application
I tried to provide uuid of users as order_id but then i read that it should be different every time.我尝试将用户的 uuid 提供为 order_id,但后来我读到它每次都应该不同。 So, I tried to provide a random generated uuid as the order_id from my front end but then it only redirected to the payment page the first time and after that it threw an error: "id doesn't not exist" If somebody can help, Thank you in advance!
所以,我试图从我的前端提供一个随机生成的 uuid 作为 order_id,但它只在第一次重定向到付款页面之后,它抛出了一个错误:“id 不存在”如果有人可以帮忙,先感谢您!
This is the document razorpay has provided for reference: https://razorpay.com/docs/payment-gateway/react-native-integration/standard/android/这是razorpay提供的参考文档: https://razorpay.com/docs/payment-gateway/react-native-integration/standard/android/
But it would help if Creating order_id was explained in terms of react native.但是,如果根据本机反应来解释创建 order_id 会有所帮助。
Don't use UUID as an order id because it would not help you must have to generate an order from Razorpay API.不要使用 UUID 作为订单 ID,因为它无助于您必须从 Razorpay API 生成订单。 in response that will send you a server-generated order id
作为响应,它将向您发送服务器生成的订单 ID
https://razorpay.com/docs/api/orders/#create-an-order https://razorpay.com/docs/api/orders/#create-an-order
fetch("https://api.razorpay.com/v1/orders", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: 50000,
currency: "INR",
}),
})
.then((response) => response.json())
.then((order) => console.log(order));
in response the created order looks like作为回应,创建的订单看起来像
{
"id": "order_EKwxwAgItmmXdp",
"entity": "order",
"amount": 50000,
"amount_paid": 0,
"amount_due": 50000,
"currency": "INR",
"offer_id": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1582628071
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.