Imagine your server sends “create order” and the network drops before the reply arrives. Did the order get created? If you retry blindly you might create two payments.
The fix: your own order_id
Send your order number as order_id. UPIPayments treats it as unique per mode:
- Same
order_idand same amount: you get the same payment back. Retry as often as you like. - Same
order_id, different amount: refused withduplicate_order_id(HTTP 409), because something is wrong.
Bonus: look up by your own id
GET /api/v1/orders/ORD-1001 works with your order id, so you never need to store our payment id if you do not want to.
0 comments