Description
POST requests that create resources (payments, invoices, transfers) should support an idempotency key so that retries caused by network failures don't create duplicate records. The key is forwarded as an Idempotency-Key header and the server will return the same response for duplicate requests.
Proposed Steps
- Add
idempotency_key: Optional[str] = None to all create resource methods.
- When provided, include it as
Idempotency-Key: <value> in the request headers.
- Auto-generate a UUID
idempotency_key when the HTTP client auto-retries a write (so retries are safe by default).
- Document the idempotency window (typically 24 hours) in docstrings.
Acceptance Criteria
- Passing
idempotency_key="my-key" to a create method sends Idempotency-Key: my-key in the header.
- Omitting
idempotency_key on auto-retried write requests still sends a generated UUID key.
- A duplicate request with the same key returns the original resource without error.
- GET/DELETE requests ignore the
idempotency_key argument.
Description
POST requests that create resources (payments, invoices, transfers) should support an idempotency key so that retries caused by network failures don't create duplicate records. The key is forwarded as an
Idempotency-Keyheader and the server will return the same response for duplicate requests.Proposed Steps
idempotency_key: Optional[str] = Noneto all create resource methods.Idempotency-Key: <value>in the request headers.idempotency_keywhen the HTTP client auto-retries a write (so retries are safe by default).Acceptance Criteria
idempotency_key="my-key"to a create method sendsIdempotency-Key: my-keyin the header.idempotency_keyon auto-retried write requests still sends a generated UUID key.idempotency_keyargument.