Idempotent Requests
The EukaPay API supports idempotency which allows you to safely retry requests without accidentally performing the same operation twice.
For example, if a create invoice request fails to respond due to some network connection error, you can retry the request with the same idempotent key to ensure that no more than one invoice was created for that particular request.
To implement idempotency on your requests, provide an additional x-idempotent-key
as part of your request header. The key should be a unique value generated by the client. The API uses this to recognize subsequent retries of the same request. We suggest using V4 UUIDs.
Idempotency keys can be up to 255 characters long.
For a particular request, the request body and resulting status code are saved for any given idempotent key, whether it succeeded or failed. Subsequent requests with the same key return the same result (either success or failure).
All Idempotent keys are eligible for removal from our system automatically once they're 24 hours old.
Sending idempotency keys for all POST and PUT requests are strongly recommended while it is unnecessary in GET and DELETE requests since these requests are idempotent by definition.
Example of Idempotent Requests
curl "https://api.eukapay.com/invoices"
-H "x-idempotent-key: some-unique-random-string"
fetch("https://api.eukapay.com/invoices", {
headers: {
x-idempotent-key: "some-unique-random-string",
.....
}
})
Updated about 2 months ago