Idempotency
Retry write requests safely.
Send an Idempotency-Key on create and capture calls so network retries do not duplicate financial operations.
Use business-stable keys
Prefer keys derived from your order or operation id, such as order_123_create and order_123_capture.
Create charge with idempotency
curl -X POST https://bunne.com.br/api/v1/charges \ -H "Authorization: Bearer sk_test_xxx" \ -H "Idempotency-Key: order_123_attempt_1" \ -H "Content-Type: application/json" \ -d '{"amount":10990,"currency":"BRL","payment_method":"PIX"}'Behavior
| Field | Type | Description |
|---|---|---|
same key + same body | replay | Returns the original successful response. |
same key + different body | error | Returns idempotency_key_conflict. |
missing key | allowed | The request still works, but retries may duplicate writes. |
Conflict response
{ "error": { "type": "idempotency_error", "code": "idempotency_key_conflict", "message": "Invalid idempotency key usage.", "request_id": "req_xxx" }}