Issue installment boletos
Creates a series of 2 to 36 independent boletos, one per installment. The response is immediate: the series and its installments are recorded PENDING, then registered at the provider one at a time.
How it works
- Send
totalAmountto split it evenly, with the remainder on the last installment. Or send each amount ininstallmentAmounts. - Installment k falls due on
firstDueDateplus (k-1) timesintervalDaysdays.intervalDaysis 1 to 365, with no business-day adjustment. fine.startDate,interest.startDate,paymentDeadlineand thediscountslimit dates are set for the first installment. Each installment adds the same days to its own due date.- Example:
firstDueDate2030-01-10,intervalDays30 andpaymentDeadline2030-01-25 give due dates 2030-01-10, 2030-02-09 and 2030-03-11, payable until 2030-01-25, 2030-02-24 and 2030-03-26. discount.limitDateis the same date on every installment, beforefirstDueDate. For a discount that follows each installment, senddiscounts.documentNumbersgives each installment its owndocumentNumber, in order. A singledocumentNumberis the same on every installment.ourNumbersgives one nosso número per installment. A number already held by an active boleto on the same provider account refuses the series before the provider is called.- Do not send
guarantor: the final beneficiary is the account holder, read once per series. - The account in
midazAccountIdmust belong to theX-Organization-Idorganization and toledgerId. - The term rules are the same as
POST /v1/boletos, judged on each installment’s own dates. GET /v1/boletos/{id}and theBOLETO_CREATEDnotification show each installment’s own dates.- A new series returns status
CREATEDandclosedfalse. Follow it atGET /v1/boletos/installments/{series_id}, and each installment atGET /v1/boletos/{id}. - Nothing is recorded when a request is refused. A refusal releases the
Idempotency-Key, so a retry under the same key runs again. - A retry under the same key returns the series in its current state with
201. AfterPBP-0013, send under a new key. - After the stored answer expires, the same key returns the series it names with
201, whatever its dates are now. Start dates are compared by day anddocumentNumbersitem by item; a resend that leaves out the originalourNumbersstill returns201. - Only a new series is refused for a first due date (
PBP-0102) or a discount limit date (PBP-0006) before today. - Refusals come in this order: auth;
Idempotency-Key(PBP-0012,PBP-0007,PBP-0013); schemaPBP-0001;PBP-0025,PBP-0026; body rules (PBP-0006,PBP-0102);ourNumbers(PBP-0102,PBP-0701,PBP-0017,PBP-0001); the stored series; the account (PBP-0005,PBP-0106,PBP-0301); the final beneficiary (PBP-0118,PBP-0116,PBP-0117,PBP-0119); the numbering account (PBP-0017,PBP-0014,PBP-0015); lastPBP-0108. - When the provider settles through this service (today BTG), incomplete accounting routes refuse the series. Check them with
GET /v1/admin/accounting-routes/preflight.
Provider differences
| Lerian (PCR) | BTG | |
|---|---|---|
| Default payment deadline | Days of the collections agreement | Days set for the tenant, or the provider default |
| Maximum payment deadline | None | Provider maximum after the due date |
| Accounting routes | Not checked | Must be complete |
Planned changes
PBP-0108: today it names the boleto that holds the nosso número whatever its organization, and reading one of another organization returns404. It will name the holder only when it belongs to theX-Organization-Idorganization.
Headers
Body
Discount of every installment. Its limitDate is absolute: the same date on every installment, before firstDueDate. For a discount whose date follows each installment's due date, send discounts. Send either discount or discounts, never both: the two together are refused with 422 PBP-0006 naming discounts.
Discount bands, one to three, in the order they apply, written for the first installment: each installment gets the same number of days, between its limitDate and firstDueDate, before its own due date. Every band has the first band's type, and each limitDate is after the previous band's and before firstDueDate; otherwise 422 PBP-0006 naming the band, as in discounts[1].limitDate. More than one band, on a provider that does not register them, is refused with 422 PBP-0701 naming BOLETO_DISCOUNT_BANDS in the capability member.
1 - 3 elementsPayee's own reference for each installment (seu numero), such as an invoice number: one per installment, in installment order, at most 36. Optional: when absent or null, no installment carries one; an empty list is refused with 422 PBP-0102, as is a list of another length. Each item follows the rule of documentNumber on POST /v1/boletos: 1 to 15 printable ASCII characters (space through tilde), stored as given; an item that is empty, longer than 15 characters, made only of spaces, that carries any other character or that carries markup is refused with 400 PBP-0001 naming it as documentNumbers[], counted from 0. When the provider that serves the issuance does not register it, the series is refused with 422 PBP-0701, naming BOLETO_DOCUMENT_NUMBER in the capability member; nothing is recorded and the provider is not called.
361 - 15^[ -~]{1,15}$Per-installment amounts, at most 36. When supplied, its length must match installments. On LERIAN each installment's amount must be below 100000000.00; otherwise 422 PBP-0006 naming the member, before anything is recorded.
3632Bank-side identification (nosso numero) chosen by the payee for each installment: one number per installment, in installment order, at most 36. All or none: when absent or null, the provider assigns every number, and an empty list is refused with 422 PBP-0102, as is a list of another length. Each item follows the rule of ourNumber on POST /v1/boletos: surrounding spaces are removed, a hyphen is accepted only when followed by exactly one digit, which is discarded, and any other character that is not a digit is refused; the accepted width, in significant digits, is set by the provider that serves the issuance and can differ between providers: read it as numbering.maxWidth of that provider in GET /v1/admin/providers/capabilities. A format or width refusal answers 400 PBP-0001 naming the item as ourNumbers[], counted from 0. Two installments with the same number, leading zeros ignored, are refused with 422 PBP-0102, and the problem carries the installments, counted from 1, as duplicateInstallmentNumbers. A number already held by an active boleto of this tenant on the same provider account refuses the whole series with 422 PBP-0108 before the provider is called, and the problem carries the installment as installmentNumber and, when the holder can be read and is not a hybrid boleto, its id as ourNumberHolderBoletoId. Only a series with numbers depends on the provider account lookup: 422 PBP-0017 when the provider has no numbering account for the series' midazAccountId (the installation has no account discovery, or the account is not yet enabled at the provider), 422 PBP-0014 when the provider refuses the lookup and 503 PBP-0015 when the provider does not answer.
36Last day the first installment can be paid, YYYY-MM-DD; each installment gets the same number of days added to its own due date. On or after firstDueDate and at most the maximum the provider declares after it, LERIAN declaring none; otherwise 422 PBP-0006 naming paymentDeadline. Absent, each installment's deadline is its due date plus the days the tenant set for the provider or, with none set, plus the provider's default; on LERIAN, plus the paymentDeadlineDays of the agreement the installment is issued under. A provider that does not register it refuses it with 422 PBP-0701 naming BOLETO_PAYMENT_DEADLINE in the capability member.
"2030-01-25"
Response
Created. The series is recorded with its installments in PENDING. A retry under the same key returns the series in its current state.
Emission outcome of the series, derived from its installments on every read. CREATED: some installment has no emission outcome yet. COMPLETED: every installment has an outcome and none is FAILED. PARTIAL_FAILURE: every installment has an outcome and some, not all, are FAILED; those carry errorMessage. FAILED: every installment is FAILED. It does not depend on payment, cancellation or write-off, and it can move from COMPLETED to PARTIAL_FAILURE or FAILED when the provider later refuses an accepted installment: a client waiting for the final outcome reads closed.
CREATED, COMPLETED, PARTIAL_FAILURE, FAILED 
