Guides
Billing API errors
The error envelope, the HTTP statuses Mimicr uses and the numeric codes each route returns.
Billing API errors have the same shape on every route: a numeric code from Efí's table, a name and a description. The description is a string or an object pointing at the invalid property.
{ "code": 3500030, "error": "payment_already_defined", "error_description": "Esta transação já possui uma forma de pagamento definida" }{ "code": 3500034, "error": "validation_error", "error_description": { "property": "/payment/banking_billet/customer/name", "message": "O nome deve ter nome e sobrenome." } }property follows the JSON Pointer style (/items/0/value); sometimes it's just the name (charge_id, id, token). Handle error_description as either a string or an object.
Efí doesn't document this API's HTTP error statuses. In Mimicr: validation and business rules answer 400, invalid credentials or token 401, internal failure 500. A card refusal isn't an error: it answers 200 with status: "unpaid" and refusal.
HTTP statuses
| HTTP | Body | When |
|---|---|---|
400 | 3500034 validation_error and the codes below | Validation or business rule |
401 | 3500008 unauthorized "Requisição não autorizada" | Invalid Basic on /v1/authorize; token missing, expired (600 s), from another API or the refresh_token |
404 | {"code": 404, "error": "not_found", ...} | Unknown route |
429 | 3500000 rate_limit | Only with chaos on |
500 | 3500000 internal_server_error | Internal failure, or chaos |
503 | 3500000 service_unavailable | Only with chaos on |
A body that isn't valid JSON answers 3500034 with "O corpo da requisição deve ser um JSON válido.".
Codes
| Code | error | When |
|---|---|---|
3500006 | greater_than_limit | Total over the per-transaction limit |
3500010 | property_does_not_exists | Unknown charge, carnê, plan, subscription or token |
3500021 | invalid_installments | More than 1 installment in a card subscription |
3500030 | payment_already_defined | The charge or subscription already has a payment method |
3500032 | plan_in_use | Deleting a plan with subscriptions |
3500034 | validation_error | Schema: missing or unknown property, invalid format or range |
3500036 | invalid_payment_method | Changing the due date of a non-boleto charge |
3500038 | invalid_status | Changing the due date outside waiting or unpaid |
3500040 | invalid_status | Canceling or updating a subscription outside new or active |
3500041 | invalid_repeats | repeats under 2 (carnê, plan) |
3500043 | invalid_status | Canceling a charge or parcel that isn't open |
3500044 | invalid_status | Paying or linking a charge that isn't new |
3500053 | missing_total | GET /v1/installments without total |
3500054 | missing_brand | GET /v1/installments without brand |
3500056 | invalid_brand | Invalid card brand |
3500066 | invalid_status | Resending a boleto or parcel that isn't waiting |
3500068 | invalid_status | Changing a canceled carnê |
3500073 | invalid_discount | Discount on a marketplace charge |
3500080 | link_already_defined | Second link on the same charge |
3500081 | invalid_status, invalid_payment_method | Write-off outside a waiting/unpaid boleto; retry outside an unpaid card; refund outside a paid card |
3500083 | carnet_finished | Changing a finished carnê |
3500085 | invalid_charge | Balance sheet on a carnê parcel or subscription charge |
3500086 | balance_sheet_exists | Second balance sheet |
3500097 | link_not_found | Updating the link of a charge without one |
3500098 | invalid_status | Updating or resending a link that isn't in link |
3500101 | update_parcels, refund_in_progress, refund_not_allowed, invalid_payment_method | Carnê parcel rules, refund in progress or with marketplace, updating a boleto subscription |
4600007 | invalid_expire_at | Boleto or carnê due date in the past |
4600059 | invalid_repeats | Carnê with more than 24 parcels |
4600060 | invalid_date | Invalid or past link expiry |
4600089 | invalid_installments | More than 12 card installments |
4600521 | invalid_conditional_discount | Conditional discount date outside today to the due date |
4600523 | invalid_discount | Total after discount under R$ 5.00 |
The error names Efí doesn't publish (the official table has only code and message) are Mimicr's choices; codes and messages follow Efí's table.
Errors you can trigger
| To test | Do |
|---|---|
3500008 | Use a token from another Efí API, or wait 600 s (or advance the sandbox clock) |
| Card refusal | payment_token of a card ending in 1, 2 or 3 (see Credit card) |
500, 503, 429 and latency | cobrancas chaos with apiErrorRate and apiErrorStatus (see Sandbox control) |
Chaos doesn't act on GET /v1/notification/{token}.