Idempotency: why you should always send an order_id

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_id and same amount: you get the same payment back. Retry as often as you like.
  • Same order_id, different amount: refused with duplicate_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

Leave a comment

Not shown publicly.
Chat with us
Hi! Send us a message and we will reply here as soon as we can.