Idempotent Transaction Requests
PayEngine supports idempotency for safely retrying transaction requests without accidentally performing a duplicate execution of the same requests. Idempotency is supported with Auth, Sale, Capture, Refund and Void APIs
To mark an idempotent request, provide an additional HTTP header request-key
in supported APIs. PayEngine saves the response of the first request regardless of its failure or success; subsequent requests with the same request-key
will produce the same response. This is very useful if a request times out and client needs to retrieve the response of the previous request.
A request-key
is a unique value generated by client and we recommend to use UUIDs or any unique key with enough entropy to avoid collision. PayEngine system will clean up the keys after 24 hours.
Results are stored including failed respoenses. This feature is to support safe retries and it is client's responsibility to maintain uniqueness of the request-key
Sample Sale Request
Subsequent calls of this request will always yield the same results as the firtst call until the request-key
expires (24 hours)
curl --location --request POST 'https://<PayEngine Host>/api/payment/sale' \
--header 'Authorization: Basic <Your Private Key>' \
--header 'Content-Type: application/json' \
--header 'request-key : <Unique Reqeust Key>' \
--data-raw '{
"merchant_id": "<Your Merchant ID>",
"data": {
"transaction_amount": "10.00",
"card_token": "<Your Card Token>",
}
}'
Last updated