Guides
Billing API (Cobranças)

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.

json
{ "code": 3500030, "error": "payment_already_defined", "error_description": "Esta transação já possui uma forma de pagamento definida" }
json
{ "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

HTTPBodyWhen
4003500034 validation_error and the codes belowValidation or business rule
4013500008 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
4293500000 rate_limitOnly with chaos on
5003500000 internal_server_errorInternal failure, or chaos
5033500000 service_unavailableOnly 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

CodeerrorWhen
3500006greater_than_limitTotal over the per-transaction limit
3500010property_does_not_existsUnknown charge, carnê, plan, subscription or token
3500021invalid_installmentsMore than 1 installment in a card subscription
3500030payment_already_definedThe charge or subscription already has a payment method
3500032plan_in_useDeleting a plan with subscriptions
3500034validation_errorSchema: missing or unknown property, invalid format or range
3500036invalid_payment_methodChanging the due date of a non-boleto charge
3500038invalid_statusChanging the due date outside waiting or unpaid
3500040invalid_statusCanceling or updating a subscription outside new or active
3500041invalid_repeatsrepeats under 2 (carnê, plan)
3500043invalid_statusCanceling a charge or parcel that isn't open
3500044invalid_statusPaying or linking a charge that isn't new
3500053missing_totalGET /v1/installments without total
3500054missing_brandGET /v1/installments without brand
3500056invalid_brandInvalid card brand
3500066invalid_statusResending a boleto or parcel that isn't waiting
3500068invalid_statusChanging a canceled carnê
3500073invalid_discountDiscount on a marketplace charge
3500080link_already_definedSecond link on the same charge
3500081invalid_status, invalid_payment_methodWrite-off outside a waiting/unpaid boleto; retry outside an unpaid card; refund outside a paid card
3500083carnet_finishedChanging a finished carnê
3500085invalid_chargeBalance sheet on a carnê parcel or subscription charge
3500086balance_sheet_existsSecond balance sheet
3500097link_not_foundUpdating the link of a charge without one
3500098invalid_statusUpdating or resending a link that isn't in link
3500101update_parcels, refund_in_progress, refund_not_allowed, invalid_payment_methodCarnê parcel rules, refund in progress or with marketplace, updating a boleto subscription
4600007invalid_expire_atBoleto or carnê due date in the past
4600059invalid_repeatsCarnê with more than 24 parcels
4600060invalid_dateInvalid or past link expiry
4600089invalid_installmentsMore than 12 card installments
4600521invalid_conditional_discountConditional discount date outside today to the due date
4600523invalid_discountTotal 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 testDo
3500008Use a token from another Efí API, or wait 600 s (or advance the sandbox clock)
Card refusalpayment_token of a card ending in 1, 2 or 3 (see Credit card)
500, 503, 429 and latencycobrancas chaos with apiErrorRate and apiErrorStatus (see Sandbox control)

Chaos doesn't act on GET /v1/notification/{token}.