EasyParcel (Singapore) Help Centre

Login Sign Up
Welcome
Login

How do I prevent duplicate orders with idempotency_key?

Quick Summary

Add an idempotency_key to your submit request. If you retry with the same key, EasyParcel returns the original response instead of creating a second order.

We'll Cover:


Why use it?

A timeout means you stopped waiting. It does not mean the order failed. The order is usually created, and you never received the response. A retry could then create a second order.


How to use it?

{
  "api": "your-api-key",
  "idempotency_key": "your-unique-reference",
  "bulk": [ ... ]
}

When you retry, send the same key and the same body. It works on EPSubmitOrderBulk and MPSubmitOrderBulk. Payment endpoints do not need it.


Choosing a key

  • One key per order attempt. Create it before the first send and store it.
  • Use your own order reference or a UUID. Maximum 255 characters.
  • Keys are unique within your own integration.
  • Never reuse a key for a new order.

When you send the same key again?

SituationWhat you get
First callProcessed normally and the response is stored
Original succeededThe original response, no second order
Original still runningerror_code 10. Nothing is created. Retry later with the same key
Original returned an errorThe key is released. Your retry is processed as new
Same key, different bodyerror_code 11. Nothing is created

On a bulk submit with some failed parcels, the mixed result is stored. Submit the failed parcels under a new key. A key is remembered for 24 hours.


Retry tips

  • On a timeout, always retry with the same key.
  • Wait 30 to 60 seconds before retrying, because a large bulk submit keeps running after you disconnect.
  • Send a byte-identical body. For example, 1.000 and 1.0 count as different.
  • On error_code 11, send the original body or use a new key.

Still need help?
Our team is happy to help. ? Live Chat  |  ✉️ Contact Us

E
EasyParcel is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.