To prevent certain operations from accidentally being performed multiple times, our API supports idempotent requests. If you attempt an operation twice or more, only the first attempt will be processed. To perform an idempotent request, send the request with a value in the HTTP header X-GCS-Idempotence-Key. The max length of this value is 40 and it doesn't support utf-8 characters. All requests with the same key will be considered attempts for the same request, even if the payload is different. It is therefore important that you use unique keys, for example UUIDs. These keys are stored for a period of at least 24 hours. If a second attempt is sent with the same key, there are two possible outcomes:
- If the first request has finished, the same response is returned. However, information relative to the payment may be updated; for example, the current status of a payment.
- If the first request has not finished yet, a response with HTTP response code 409 (Conflict) is sent instead. It means the request is being executed. You should be prepared to handle this case.
To distinguish the first attempt from subsequent attempts with the same key, responses for all subsequent requests all include HTTP header X-GCS-Idempotence-Request-Timestamp, with as its value the timestamp of the first request, as the number of milliseconds since January 1st 1970 00:00:00 UTC.
The following methods currently support idempotent requests: