Issue a single boleto
Issues one TRADITIONAL boleto through the provider the tenant routes BOLETO_ISSUANCE to.
How it works
- The final beneficiary (sacador avalista) is always the holder of the issuing account, read from the account’s registration. Do not send
guarantor: the response returns it. - The payer cannot be the holder of the issuing account.
discountstakes 1 to 3 bands of one type. Limit dates go in increasing order, each before the due date. An emptydiscountsis400 PBP-0001.discountwithdiscountsis422 PBP-0006.fine.startDateandinterest.startDatefall after the due date and on or before the payment deadline. Without them, fine and interest start the day after the due date.- When the deadline is the due date (for example, 0 days set for the tenant), a
fineorinterestwithout a start date is refused with422 PBP-0006. documentNumber(seu número) has 1 to 15 printable ASCII characters. It does not have to be unique. A longer value is refused, never cut.paymentDeadlineis on or after the due date. Without it, the provider’s default applies (see the table below). The response shows the deadline in effect.- No date may fall after 9999-12-31, a default deadline included.
- A term the provider does not register is refused with
422 PBP-0701. - An
ourNumber(nosso número) already held by an active boleto of the same provider account is refused with422 PBP-0108before the provider is called. - A number held by a title this service cannot see (another deployment or tenant on the same provider account) is accepted, then refused by the provider: the boleto moves to
FAILED. If that title is this same emission, the boleto is bound to it. If the provider cannot tell whose title it is, the boleto staysPENDING. - Checks run in this order, and none issues anything: authentication,
Idempotency-Key, body schema (empty required members, markup), typeHYBRID(501), the account (404 PBP-0005), BTG accounting routes (422 PBP-0128,503 PBP-0301), the final beneficiary (503 PBP-0118,400 PBP-0116,422 PBP-0117,422 PBP-0119), the provider account (422 PBP-0017,422 PBP-0014,503 PBP-0015), Lerian (PCR) term rules (422 PBP-0006), then the nosso número (422 PBP-0108).
Responses and retries
201: the provider accepted the boleto. The body hasproviderId. With BTG it also hasbarcodeanddigitableLine. With Lerian (PCR) they appear once the registration is confirmed and the boleto isCREATED.202: the emission was sent, and the provider’s answer is not confirmed yet. The boleto isPENDING. Read it withGET /v1/boletos/{id}.- After a
202, do not send the boleto under a newIdempotency-Key: the provider may have issued it. Use a new key only when the boleto readsFAILED. - The response,
GET /v1/boletos/{id},GET /v1/boletosand theBOLETO_CREATEDnotification show the terms as recorded. - A provider refusal that proves no title was issued leaves the boleto
FAILEDand sendsBOLETO_FAILED. - A provider refusal with a code of its declared refusal catalog comes with that code and its registered status (
409or422), the catalog’sdetailand, when given,providerReason. - A code outside the catalog is answered
500: the boleto isFAILEDandBOLETO_FAILEDis sent. A retry under the sameIdempotency-Keysends the emission again and, refused again, records anotherFAILEDboleto. - A retry under the same
Idempotency-Keyreturns the stored201or202. After a refusal that issued nothing (for examplePBP-0116,PBP-0117,PBP-0119,PBP-0014,PBP-0017,PBP-0128or a503), it runs the request again. - A resend of a
202under the same key returns the same202even after the boleto is completed: read the boleto by id. - After the stored answer expires, the same key returns the boleto recorded under it (
201, or202while it isPENDING), whatever its dates are now, and sends nothing again. Any changed member is422 PBP-0013. If the provider that recorded it is no longer installed, the answer is503 PBP-0704.
Provider differences
| Lerian (PCR) | BTG | |
|---|---|---|
| Status | Under development. Can change before it is released. | Available |
| Nosso número | Up to 16 digits | Up to 11 digits |
| Default deadline | Days of the collections agreement | Days set for the tenant, or 30 |
| Maximum deadline | None | 365 days after the due date |
| Instructions | Refused with 422 PBP-0701 (BOLETO_INSTRUCTIONS) | Accepted |
| Term checks | This service’s rules, then the collections rules, before anything is recorded (422 PBP-0006) | This service’s rules (422 PBP-0006), then the bank |
| Accounting routes | Not checked | Must be complete |
Planned changes
- Lerian (PCR): today a refusal when the title is registered, such as an account without a collections agreement while automatic enablement is off, is
422 PBP-0014. Each refusal will get its own code instead:PBP-0801: a capability the first version does not offer (product type, species, portfolio, or an institution without its own number code).PBP-0821: an informed nosso número longer than 16 digits (here refused first with400 PBP-0001).PBP-0831: the account has no collections agreement and automatic enablement is off. Enable the account, or turn automatic enablement on in the collections settings.PBP-0832: an issuance rule is broken. Only this code carriesproviderReason, the rule’s stable identifier, never a request value:MISSING_DATE,DUE_DATE_TOO_FAR,DUE_DATE_BEFORE_FACTOR_RANGE,PAYMENT_DEADLINE_BEFORE_DUE,AMOUNT_NOT_POSITIVE,AMOUNT_PRECISION,AMOUNT_TOO_LARGE_FOR_BARCODE,PROJECTED_TOTAL_OUT_OF_RANGE,NEGATIVE_VALUE,VALUE_TOO_LARGE,PERCENTAGE_PRECISION,EXEMPT_CODE_WITH_VALUE,CALCULATION_MODEL_UNKNOWN,CALCULATION_MODEL_DISCONTINUED,INTEREST_CODE_UNKNOWN,INTEREST_CODE_NOT_IN_MODEL_01,INTEREST_VALUE_NOT_POSITIVE,INTEREST_VALUE_OUT_OF_RANGE,INTEREST_DATE_NOT_AFTER_DUE,INTEREST_DATE_AFTER_DEADLINE,INTEREST_DATE_WITH_EXEMPT_INTEREST,DAILY_RATE_NOT_REPRESENTABLE,FINE_CODE_UNKNOWN,FINE_VALUE_OUT_OF_RANGE,FINE_DATE_NOT_AFTER_DUE,FINE_DATE_AFTER_DEADLINE,FINE_DATE_WITH_EXEMPT_FINE,DISCOUNT_CODE_UNKNOWN,DISCOUNT_VALUE_OUT_OF_RANGE,DISCOUNT_DATE_NOT_BEFORE_DUE,DISCOUNT_DATES_NOT_INCREASING,DISCOUNT_DATE_WITH_EXEMPT_DISCOUNT,TOO_MANY_DISCOUNT_BANDS,MIXED_DISCOUNT_CODES,REBATE_NOT_BELOW_AMOUNT,DISCOUNT_AND_REBATE_NOT_BELOW_AMOUNT,DOCUMENT_NUMBER_TOO_LONG,DOCUMENT_NUMBER_INVALID_CHARACTER,OUR_NUMBER_EMPTY,OUR_NUMBER_NOT_DIGITS,FINAL_BENEFICIARY_MISSING,PARTY_DOCUMENT_INVALID,PARTY_NAME_INVALID,PARTY_ADDRESS_INVALID.
PBP-0108: today it names the holder whatever its organization, and reading a holder of another organization returns404. The holder will be named only when it belongs to theX-Organization-Idorganization.
Cabeçalhos
Corpo
1 to 3 discount bands, in the order they apply. Each band grants its amount when the boleto is paid on or before its limitDate.
- All bands have the type of the first band.
- Each
limitDateis after the previous one and before the due date. Otherwise 422PBP-0006naming the band, as indiscounts[1].limitDate. - One band is the same as
discount. Do not send both (422PBP-0006namingdiscounts). - More than one band, on a provider that does not register them, is refused with 422
PBP-0701andcapabilityBOLETO_DISCOUNT_BANDS.
1 - 3 elementsYour own reference for the charge (seu número), such as an invoice number. Optional. It does not have to be unique, and it is stored as sent.
- 1 to 15 printable ASCII characters (space through tilde: letters without accents, digits, space and punctuation).
- Empty, longer than 15 characters, only spaces, any other character (accented letter, control character, non-ASCII) or markup: 400
PBP-0001. A longer value is refused, never cut. - A provider that does not register it refuses it with 422
PBP-0701andcapabilityBOLETO_DOCUMENT_NUMBER. Nothing is recorded and the provider is not called.
1 - 15^[ -~]{1,15}$"NF-2030/0001"
Bank identification of the boleto (nosso número), chosen by you. Optional: without it, the provider assigns the number.
- Digits only. Surrounding spaces are removed. A hyphen is accepted only when followed by exactly one digit, which is dropped because the bank computes the check digit:
152-3is sent as152;152-and152-abcare refused. - Leading zeros do not count:
152and00000000152are the same number. - Maximum width, in significant digits: BTG 11, Lerian (PCR) 16. Read
numbering.maxWidthinGET /v1/admin/providers/capabilities. - Format and width refusals: 400
PBP-0001. A provider that does not accept a number you choose: 422PBP-0701withcapabilityCLIENT_SUPPLIED_OUR_NUMBER. - A number held by an active boleto of any type of the same provider account (a hybrid issued earlier included) is refused with 422
PBP-0108, before the provider is called. When the holder can be read, thedetailnames it andourNumberHolderBoletoIdcarries its id. It can be an earlier emission of the same charge: read it before you use another number. When it is an emission still without a provider answer, thedetailsays so. - After a 422
PBP-0014or a5xxanswered once the emission was sent, the number stays held until reconciliation resolves that emission, which happens no earlier than a grace period (30 minutes by default). Meanwhile that emission can still become a live boleto: issuing the same charge with another number can leave two boletos. Refusals answered before the emission was sent hold nothing.
"00000000152"
Last day the boleto can be paid, YYYY-MM-DD. On or after the due date.
- Maximum: BTG, 365 days after the due date. Lerian (PCR), no maximum. Out of range: 422
PBP-0006namingpaymentDeadline. A fine or interest start date after it is refused the same way. - Without it: BTG uses the due date plus the days set for the tenant, or 30 days. Lerian (PCR) uses the due date plus the
paymentDeadlineDaysof the agreement the boleto is issued under. - A provider that does not register it refuses it with 422
PBP-0701andcapabilityBOLETO_PAYMENT_DEADLINE.
"2030-02-14"
Resposta
Created. The provider accepted the boleto: the body has its providerId. The boleto stays PENDING until the provider confirms the registration. With BTG the body also has barcode and digitableLine. With Lerian (PCR) they appear once the registration is confirmed and the boleto is CREATED: read it with GET /v1/boletos/{id}.
Bank identification of the boleto (nosso número), as the provider registered it, with leading zeros, at the provider's width. If you sent a different number, this is the one the provider issued.
- Absent while the provider has not made it known, and on boletos issued before this field existed. Reconciliation fills it in later, with no action from you.
- Never sent as an empty string.
29
Check digit of ourNumber, computed by the bank and never accepted in a request. Absent when the provider does not return it: providers return it only for numbers they assigned, and some never return it. Without it, show ourNumber alone, with no trailing hyphen. With it, show {ourNumber}-{ourNumberDigit}.
"3"
Last day the boleto can be paid, YYYY-MM-DD: the one you sent or, without it, the tenant setting or the provider default (Lerian (PCR): due date plus the agreement's paymentDeadlineDays). Absent when the provider registers no deadline, while Lerian (PCR) has not answered the emission, and on a resend answered by a boleto recorded before the service stored the deadline.
"2030-01-31"

