curl https://api.hips.com/v2/payment \ -u private_4eC39HqLyjWDarjtT1zdp7dc: \ -H "Idempotency-Key: g5NjkI2VbaH0cf7f" \ -d amount=2000 \ -d currency=usd \ -d description="Charge for [email protected]" \ -d source=card
Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, all subsequent retries return the result from the original successful request and they have no additional effect.
To perform an idempotent request, provide an additional
Idempotency-Key: <key> header to the request.
The idempotency key should be an unique value generated by the client which the server uses to recognize subsequent retries of the same request. We suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions.
Idempotency-Key should only be sent in POST messages. A successful POST message will return HTTP code 201. A successful POST message with a previous processed Idempotency-Key will return HTTP code 200 with a copy of the original POST result.
Idempotency-Keys are valid for 3600 seconds