Implementation
1
Generate an idempotency key
The idempotency key must be a valid UUID. Generate a unique UUID for each distinct request you intend to make.
2
Include the header in your request
Add the
Idempotency-Key
header to your HTTP request with the generated UUID.3
Handle retries
When you need to retry a previous request due to network issues or timeouts, always use the same idempotency key as the original request.
Store the idempotency key alongside your request metadata until you receive a successful response. This way, retries for the same entity state will always result in the same key.
If a retried request uses the same idempotency key but different parameters, PaySway will reject it. This prevents accidental misuse and ensures the idempotency key always refers to the same request.