如何在 razorpay 的 firebase 上创建 order_id?我正在将 react-native 与 firebase 一起用于移动应用程序

How to create order_id on firebase for razorpay? I am using react-native with firebase for mobile application

我试图将用户的 uuid 提供为 order_id 但后来我读到它应该每次都不同。因此,我尝试从我的前端提供一个随机生成的 uuid 作为 order_id,但随后它只在第一次重定向到支付页面,之后它抛出了一个错误:"id doesn't not exist" 如果有人可以提供帮助, 先谢谢了!

这是razorpay提供的文档供参考:https://razorpay.com/docs/payment-gateway/react-native-integration/standard/android/

但是,如果创建 order_id 是根据 react native 来解释的,那将会有所帮助。

不要使用 UUID 作为订单 ID,因为它没有帮助 您必须从 Razorpay API 生成订单。作为回应,将向您发送服务器生成的订单 ID

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

作为响应,创建的订单看起来像

{
  "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
}