简体   繁体   English

如何在 firebase 上为 razorpay 创建 order_id? 我正在使用 react-native 和 firebase 进行移动应用程序

[英]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.

相关问题 嘿,我正在尝试使用 react-native 和 firebase 作为我的主数据库来构建一个博客应用程序 - hey i am trying to build a blogging application using react-native and firebase as my primary database 如何在 android 和 Z1BDF605991920DB11CBDF850820 的 react-native 应用程序中使用 firebase 成功执行 Google 登录? - How can I successfully perform Google-login using firebase in react-native application for android and iOS both if I am having different client IDs? 使用react-native将textipnput数据保存到Firebase的移动应用程序 - save textipnput data to firebase using react-native for mobile app 我可以使用 React-native、firebase 和节点 js 创建应用程序吗? - Can i create an app with React-native, firebase, and node js? 嘿,如何使用 react native 和 firebase 创建博客应用程序 - Hey how to create a blogging application using react native and firebase 使用Firebase创建群组聊天反应本机 - Create groups chat react-native using firebase 我可以使用 firebase 和 react-native 验证电话号码吗? - Can I verify a phone number using firebase and react-native? 如何获得 react-native 中的 firebase 值? - How get firebase value in react-native? 如何在 react-native 中检索 firebase 数据 - how to retrieve firebase data in react-native 如何去除 react-native firebase 依赖 - How to remove react-native firebase dependency
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM