Use idempotency keys for requests that create or move money, such as collections and disbursements.
How idempotency works
For sensitive actions, include anIdempotency-Key header in your request.
Recommended key format
Use a unique UUID for every new transaction request.Example request
When to use idempotency
Collections
Recommended when you create a collection request that may be retried.
Disbursements
Required when you create a disbursement request that sends funds.
Important rules
- Generate a new idempotency key for every new transaction.
- Reuse the same idempotency key only when retrying the same request.
- Do not reuse one idempotency key across different customers, payments, or payouts.
- Store the idempotency key with your internal transaction record.
- Use UUIDs or another high-entropy unique value.
Duplicate prevention
If Pasteaza detects a duplicate request, it returns the original transaction response. This helps prevent issues such as:- Creating the same collection twice
- Sending the same disbursement twice
- Debiting a balance more than once
- Creating confusing webhook events
Retry flow
Retry with the same key
If the first request times out, retry the same request with the same idempotency key.