> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Initiate a payment

> <Warning>**Under development.** This Payments PCR preview is subject to change. Endpoint descriptions distinguish current behavior from planned changes. Confirm availability with Lerian before integration.</Warning>

Pays a bank slip (boleto) or a utilities bill through the provider the tenant routes `BANKSLIP_PAYMENT` or `BARCODE_BILL_PAYMENT` to. The type comes from the digitable line.

<Info>**Providers:** BTG.</Info>

**How it works**

- The payment runs at once. There is no scheduling: a `scheduledDate` is refused.
- Before anything is created, the provider checks the slip. A slip that cannot be paid, or that the source refuses or does not know, creates nothing.
- The payer is always the registered owner of the funding account (`midazAccountId`). Do not send payer data.
- Funds are reserved in the ledger before the provider is instructed.
- `201`: the provider acknowledged the payment (status `CREATED`). `202`: the outcome is not known (status `UNCONFIRMED`). Follow both with `GET /v1/payments/{id}`.
- After a `202`, do not resend under a new `Idempotency-Key`: the provider may have it, and you can pay twice.
- A retry under the same `Idempotency-Key` returns the stored answer of a `201`, a `202`, or a refusal that consumes the key (see each code). After a refusal that releases the key, the same key runs the request again. While the first request runs, the same key gets `409` `PBP-0007`.
- To find what a request created when you have no payment id, call `GET /v1/payments` with `idempotencyKey`.

**Planned changes**

- Lerian (PCR): boleto payment through Lerian (PCR) is planned. The body gains optional `amount` (informed amount), `channel` and `paymentMethod`, and the payment can pass an antifraud step. Lerian sets up the tenant's antifraud, default channel and payment method at onboarding. No client endpoint reads or changes them.
- DDA (electronic payer): new optional `receiverBoletoId`, the presented boleto being paid. With `channel` `DDA`, it is required, must name a boleto presented to the holder of `midazAccountId`, and `digitableLine` must be that boleto's line.
- Payment scheduling: a future `scheduledDate` is sent to the provider on its effective date (first business day on or after it), once. Adds `scheduledDate` (DARF too), `effectiveScheduledDate`, `effectiveAfterDueDate`, `amountIsEstimated`, `executedAt`, `failureReason`, the `PROCESSING` status and new error codes. This change will be specified again before it applies.



## OpenAPI

````yaml /pt/openapi/v3-current/payments-pcr.yaml post /v1/payments
openapi: 3.1.0
info:
  title: Payments PCR preview
  version: 2026-11-23-preview
  description: >-
    Preview of Payments with boleto collections through Lerian (PCR), CNAB 240,
    electronic payers (DDA), bill payments, and shared administration. This
    reference includes current behavior and planned changes. Read each
    operation's provider information: some operations support BTG only today.
    The preview is under development and can change before release. Confirm
    availability with Lerian before integration.


    The webhooks section describes notices Payments sends to your callback URL.
    Verify the signature and timestamp before processing a notice. Use the
    eventId and X-Webhook-Id described by each notice to detect repeated
    delivery. Do not assume delivery order.
servers:
  - url: https://api.example.com
    description: >-
      Replace the example host with the URL provided during environment
      onboarding.
security: []
tags:
  - description: >-
      Tenant-level setup: connecting the banking provider and configuring where
      status notifications are delivered.
    name: Admin
  - description: Issuing, querying and cancelling boletos, and retrieving the rendered PDF.
    name: Boletos
  - name: CNAB Agreements
    description: >-
      CNAB agreements: the link between a Lerian-provider collections agreement
      and the CNAB 240 Lerian files of one account, with its remittance and
      return sequence numbers (NSA) and its return cut times. Every operation of
      this section answers 422 PBP-0900 to a tenant without CNAB 240 enabled.
  - name: CNAB Remittances
    description: >-
      CNAB remittances: the CNAB 240 Lerian remittance files of an organization,
      each received whole, validated and stored encrypted, its title lines
      executed afterwards. A file already received is answered with its stored
      receipt; a new one answers 422 PBP-0900 to a tenant without CNAB 240
      enabled.
  - name: CNAB Returns
    description: >-
      CNAB 240 Lerian return files, one per agreement and cut, built from the
      journal of what happened to the titles that entered by remittance, and
      their download. Every operation of this section answers 422 PBP-0900 to a
      tenant without CNAB 240 enabled.
  - description: >-
      Boleto collections agreements and their reconciliation with the
      beneficiary base of the PCR: the consumption of each beneficiary inventory
      the PCR publishes and the divergences it raises, which carry only
      agreement and situation attributes, never a document or a name. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Agreements
  - description: >-
      Boleto collections audit trail: every operation and configuration action,
      append-only, with its author, instant, reason, evidence and the module's
      fields before and after it. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections Audit
  - description: >-
      Boleto collections beneficiaries: the enablement of the tenant's accounts
      for collections, in batches of up to 5,000 accounts, and the progress and
      per-item outcome of the enablement and bulk adoption batches. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Beneficiaries
  - name: Collections Credit Entries
    description: >-
      Boleto collections credit entries: what the credit of each write-off moves
      in the ledger, one entry per write-off and phase, the RELEASE to the
      available balance of the title's account and the CHARGEBACK of a write-off
      cancelled after its release, with where each entry stands with the ledger
      and, when it is not posted, why, as a closed code and never the ledger's
      own text. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
  - description: >-
      Boleto collections operation queues: each case that waits for an operator
      and already has its state in collections, with its reason, since when it
      waits and the operations that act on it, read over the states collections
      keeps rather than from a list of its own. Each queue counts the items
      whose age reached its age limit, a per-tenant operational parameter. Every
      operation of this section answers 422 PBP-0830 to a tenant without
      collections enabled.
    name: Collections Operation Queues
  - description: >-
      Boleto collections commands to the PCR: each registration, change and
      write-off sent to the PCR of the institution, with the idempotency key it
      keeps across attempts, its attempts, its next attempt and the last answer
      that did not accept it, never the body sent. Every operation of this
      section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Commands
  - description: >-
      Boleto collections notice subscription of the tenant's connection to the
      PCR: its synchronization with the PCR, the rotation of the secret the PCR
      signs the notices with, the deliveries of notices the PCR recorded for it,
      and the redelivery of a notice whose delivery failed. Every operation of
      this section answers 422 PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Connection
  - description: >-
      Boleto collections notices received from the PCR: each event the PCR of
      the institution delivered to collections, stored once per connection and
      event, with where its processing stands and what it was matched with,
      never the body received. Every operation of this section answers 422
      PBP-0830 to a tenant without collections enabled.
    name: Collections PCR Notices
  - description: >-
      Boleto collections pooled accounts: the links of accounts that issue under
      the agreement of a pooled account, whose holder stays the beneficiary
      while the account's holder is the final one. A link registers nothing at
      Núclea. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
    name: Collections Pooled Accounts
  - description: >-
      Boleto collections setup: the tenant's business settings, with the default
      agreement template, the automatic enablement and the retention periods,
      and the tenant's connection to the PCR of its institution. Every operation
      of this section answers 422 PBP-0830 to a tenant without collections
      enabled.
    name: Collections Settings
  - description: >-
      Boleto collections titles: each boleto collections issues at the PCR of
      the institution, with its four state axes (registration, situation at the
      base, credit and block), never the data of a payer or of a beneficiary.
      The barcode and the digitable line are answered only while the title is
      REGISTERED. Every operation of this section answers 422 PBP-0830 to a
      tenant without collections enabled.
    name: Collections Titles
  - name: Collections Write-offs
    description: >-
      Boleto collections write-offs: each write-off of a collections title the
      PCR of the institution notified, with its route, its settlement, the state
      of its credit, its hold and its cancellation deadline, never the data of a
      payer. Every operation of this section answers 422 PBP-0830 to a tenant
      without collections enabled.
  - description: >-
      Aggregated counts, amounts and breakdowns over a period, for boletos and
      for payments.
    name: Dashboards
  - name: Electronic payers
    description: >-
      Electronic payer (DDA): adhesion of the institution's customer to
      electronic presentment of boletos, its accounts and aggregates, and the
      outcome of each request. Under development: can change before it is
      released.
  - description: >-
      The notices Payments posts to the tenant's callback URL, one per type
      enabled in enabledEvents, each signed with the configuration's secret.
      Each item describes the body, the delivery headers, when the notice is
      sent and which providers send it. The webhook is the channel of the first
      delivery: delivery will later move to Lerian's Streaming Hub, which will
      then be the only channel, with a change of subscription and a migration
      plan communicated to the client.
    name: Notices
  - description: >-
      Paying bankslips, utility bills and DARF tax slips, and querying those
      payments.
    name: Payments
  - name: Presented boletos
    description: >-
      Boletos of other institutions presented to the electronic payer: list,
      detail, acceptance and authorized third parties. Under development: can
      change before it is released.
paths:
  /v1/payments:
    post:
      tags:
        - Payments
      summary: Initiate a payment
      description: >-
        <Warning>**Under development.** This Payments PCR preview is subject to
        change. Endpoint descriptions distinguish current behavior from planned
        changes. Confirm availability with Lerian before integration.</Warning>


        Pays a bank slip (boleto) or a utilities bill through the provider the
        tenant routes `BANKSLIP_PAYMENT` or `BARCODE_BILL_PAYMENT` to. The type
        comes from the digitable line.


        <Info>**Providers:** BTG.</Info>


        **How it works**


        - The payment runs at once. There is no scheduling: a `scheduledDate` is
        refused.

        - Before anything is created, the provider checks the slip. A slip that
        cannot be paid, or that the source refuses or does not know, creates
        nothing.

        - The payer is always the registered owner of the funding account
        (`midazAccountId`). Do not send payer data.

        - Funds are reserved in the ledger before the provider is instructed.

        - `201`: the provider acknowledged the payment (status `CREATED`).
        `202`: the outcome is not known (status `UNCONFIRMED`). Follow both with
        `GET /v1/payments/{id}`.

        - After a `202`, do not resend under a new `Idempotency-Key`: the
        provider may have it, and you can pay twice.

        - A retry under the same `Idempotency-Key` returns the stored answer of
        a `201`, a `202`, or a refusal that consumes the key (see each code).
        After a refusal that releases the key, the same key runs the request
        again. While the first request runs, the same key gets `409` `PBP-0007`.

        - To find what a request created when you have no payment id, call `GET
        /v1/payments` with `idempotencyKey`.


        **Planned changes**


        - Lerian (PCR): boleto payment through Lerian (PCR) is planned. The body
        gains optional `amount` (informed amount), `channel` and
        `paymentMethod`, and the payment can pass an antifraud step. Lerian sets
        up the tenant's antifraud, default channel and payment method at
        onboarding. No client endpoint reads or changes them.

        - DDA (electronic payer): new optional `receiverBoletoId`, the presented
        boleto being paid. With `channel` `DDA`, it is required, must name a
        boleto presented to the holder of `midazAccountId`, and `digitableLine`
        must be that boleto's line.

        - Payment scheduling: a future `scheduledDate` is sent to the provider
        on its effective date (first business day on or after it), once. Adds
        `scheduledDate` (DARF too), `effectiveScheduledDate`,
        `effectiveAfterDueDate`, `amountIsEstimated`, `executedAt`,
        `failureReason`, the `PROCESSING` status and new error codes. This
        change will be specified again before it applies.
      operationId: initiatePayment
      parameters:
        - description: >-
            Midaz organization the account and the ledger entry live under.
            Required: a request without it, or with a value that is not a
            canonical UUID, is refused with 400 PBP-0025.
          in: header
          name: X-Organization-Id
          schema:
            description: >-
              Midaz organization the account and the ledger entry live under.
              Required: a request without it, or with a value that is not a
              canonical UUID, is refused with 400 PBP-0025.
            type: string
        - description: >-
            Client-supplied idempotency key, a UUID. Required: a request without
            it, with a value that is not a UUID, or with the nil UUID
            (00000000-0000-0000-0000-000000000000) is refused with 400 PBP-0012.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            description: >-
              Client-supplied idempotency key, a UUID. Required: a request
              without it, with a value that is not a UUID, or with the nil UUID
              (00000000-0000-0000-0000-000000000000) is refused with 400
              PBP-0012.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiatePaymentRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiatePaymentResponse'
          description: >-
            Created. The provider acknowledged the payment. It is `CREATED` and
            has `providerId`. Follow its outcome with `GET /v1/payments/{id}`. A
            key that already names an acknowledged payment also returns `201`,
            with the payment as it stands.
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiatePaymentResponse'
          description: >-
            Accepted. The payment was created and sent, but the outcome is not
            known. It is `UNCONFIRMED`, with no `providerId`. Do not resend
            under a new `Idempotency-Key`: you can pay twice. It resolves on its
            own: to the status the provider reports, or to `FAILED` with its
            funds released when the provider has no record of it. A resend under
            the same key is safe: for up to 48 hours it returns this same `202`,
            even after the payment has resolved. Read the current status with
            `GET /v1/payments/{id}`. A key that names a payment still
            `UNCONFIRMED` also returns `202`.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0001:
                  summary: 'PBP-0001: Request malformed'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0001
                    title: Bad Request
                    status: 400
                    detail: validation failed
                    code: PBP-0001
                PBP-0025:
                  summary: 'PBP-0025: Organization header missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0025
                    title: Bad Request
                    status: 400
                    detail: >-
                      X-Organization-Id header is required and must be a
                      canonical UUID
                    code: PBP-0025
                PBP-0026:
                  summary: 'PBP-0026: ledgerId missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0026
                    title: Bad Request
                    status: 400
                    detail: ledgerId is required and must be a canonical UUID
                    code: PBP-0026
                PBP-0012:
                  summary: 'PBP-0012: Idempotency-Key missing'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0012
                    title: Idempotency Key Required
                    status: 400
                    detail: The Idempotency-Key header is required for this endpoint.
                    code: PBP-0012
                PBP-0204:
                  summary: 'PBP-0204: Account has no owner'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0204
                    title: Payer Not Registered
                    status: 400
                    detail: >-
                      The account this payment would be debited from has no
                      registered owner on file, so the payer cannot be
                      established. Register the account's owner, or use an
                      account that has one.
                    code: PBP-0204
          description: >-
            Bad Request. No payment was created and nothing was sent to the
            provider.


            - `PBP-0001`: the body is missing, is not JSON, fails the schema, or
            has a member this operation does not accept (`payer`, `payeeName`,
            `payeeTaxId`, `scheduledDate`). `errors[]` names each one.

            - `PBP-0025`: `X-Organization-Id` is missing or is not a UUID.

            - `PBP-0026`: `ledgerId` is missing, blank or is not a UUID.

            - `PBP-0012`: `Idempotency-Key` is missing or is not a UUID.

            - `PBP-0204`: the account in `midazAccountId` has no registered
            owner, so the payer cannot be established. Register the owner, or
            use an account that has one.


            See the [error
            list](/pt/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0003:
                  summary: 'PBP-0003: Invalid credential'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0003
                    title: Unauthorized
                    status: 401
                    detail: authentication required
                    code: PBP-0003
          description: >-
            Unauthorized.


            - `PBP-0003`: the credential is missing or invalid, or does not
            identify a tenant. Get a valid bearer token.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0004:
                  summary: 'PBP-0004: No permission'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0004
                    title: Forbidden
                    status: 403
                    detail: permission denied
                    code: PBP-0004
          description: >-
            Forbidden.


            - `PBP-0004`: the credential does not have permission for this
            operation.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0005:
                  summary: 'PBP-0005: Account not found'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0005
                    title: Not Found
                    status: 404
                    detail: Account not found or not accessible.
                    code: PBP-0005
                PBP-0110:
                  summary: 'PBP-0110: Bill not found'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0110
                    title: Bill Not Found
                    status: 404
                    detail: The payment slip was not found at its source.
                    code: PBP-0110
          description: >-
            Not Found. Nothing was created or sent. The `Idempotency-Key` is
            released.


            - `PBP-0005`: the funding account was not found or is not
            accessible.

            - `PBP-0110`: the slip's source has no bill under this digitable
            line. Check the line.


            See the [error
            list](/pt/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0007:
                  summary: 'PBP-0007: Same key still running'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0007
                    title: Request In Progress
                    status: 409
                    detail: >-
                      A request with this idempotency key is already being
                      processed.
                    code: PBP-0007
          description: >-
            Conflict.


            - `PBP-0007`: an earlier request under the same `Idempotency-Key` is
            still running. Retry under the same key after a short wait: this
            code lasts at most five minutes after the first request arrived.
            After that, the same key returns the stored answer, `500` `PBP-0002`
            when that answer cannot be replayed, or, when no answer was kept,
            runs the request again. Do not switch keys: the earlier request can
            still take effect.
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0010:
                  summary: 'PBP-0010: Body too large'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0010
                    title: Request Entity Too Large
                    status: 413
                    detail: request body too large
                    code: PBP-0010
          description: |-
            Payload Too Large.

            - `PBP-0010`: the body is larger than the size limit.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0300:
                  summary: 'PBP-0300: Insufficient funds'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0300
                    title: Insufficient Funds
                    status: 422
                    detail: >-
                      The funding account does not have enough available balance
                      to complete this operation.
                    code: PBP-0300
                PBP-0302:
                  summary: 'PBP-0302: Overdraft limit exceeded'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0302
                    title: Ledger Refused
                    status: 422
                    detail: >-
                      The ledger declined this operation. It was not completed
                      and will not be retried; resolve the condition on the
                      funding account before submitting a new request.
                    code: PBP-0302
                PBP-0014:
                  summary: 'PBP-0014: Provider refused payment'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0014
                    title: Provider Rejection
                    status: 422
                    detail: The payment was rejected by the provider.
                    code: PBP-0014
                PBP-0212:
                  summary: 'PBP-0212: Outside provider hours'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0212
                    title: Payment Outside Provider Window
                    status: 422
                    detail: >-
                      The payment provider refused this payment because it was
                      sent outside the hours it accepts payments. Nothing was
                      paid. This Idempotency-Key is consumed: resend under a new
                      Idempotency-Key once the provider accepts payments again.
                    code: PBP-0212
                PBP-0013:
                  summary: 'PBP-0013: Key used for another request'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0013
                    title: Idempotency Key Conflict
                    status: 422
                    detail: >-
                      The request body or X-Organization-Id does not match the
                      original request for this idempotency key.
                    code: PBP-0013
                PBP-0210:
                  summary: 'PBP-0210: Slip not payable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0210
                    title: Slip Not Payable
                    status: 422
                    detail: The payment slip cannot be paid.
                    code: PBP-0210
                PBP-0111:
                  summary: 'PBP-0111: Source refused the bill'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0111
                    title: Bill Refused By Source
                    status: 422
                    detail: >-
                      The payment slip was refused by its source (provider code
                      123).
                    code: PBP-0111
                PBP-0202:
                  summary: 'PBP-0202: Account validation unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0202
                    title: PAYMENT_VALIDATOR_NOT_CONFIGURED
                    status: 422
                    detail: >-
                      Account ownership validation is unavailable, so the
                      payment was NOT submitted. Retrying this request unchanged
                      will not clear the condition.
                    code: PBP-0202
                PBP-0017:
                  summary: 'PBP-0017: Provider account unresolved'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0017
                    title: PROVIDER_SETUP_INCOMPLETE
                    status: 422
                    detail: >-
                      The paying provider account could not be established, so
                      the payment was NOT submitted. Retrying this request
                      unchanged will not clear the condition.
                    code: PBP-0017
                PBP-0205:
                  summary: 'PBP-0205: Owner registration invalid'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0205
                    title: Payer Registration Invalid
                    status: 422
                    detail: >-
                      The registered owner of the account this payment would be
                      debited from is recorded inconsistently, so the payer
                      cannot be established. Correct the account owner's
                      registration; resubmitting this request unchanged will not
                      resolve it.
                    code: PBP-0205
                PBP-0208:
                  summary: 'PBP-0208: Owner document not numeric'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0208
                    title: Payer Document Not Numeric For Provider
                    status: 422
                    detail: >-
                      The registered owner of the account this payment would be
                      debited from has a tax document that is not all digits, so
                      the payment was NOT submitted.
                    code: PBP-0208
                PBP-0700:
                  summary: 'PBP-0700: No provider on the route'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0700
                    title: PROVIDER_ROUTE_NOT_CONFIGURED
                    status: 422
                    detail: >-
                      No provider is configured for BANKSLIP_PAYMENT operations
                      of this tenant, so nothing was recorded and no provider
                      was called.
                    code: PBP-0700
                PBP-0701:
                  summary: 'PBP-0701: Capability not supported'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0701
                    title: PROVIDER_CAPABILITY_NOT_SUPPORTED
                    status: 422
                    detail: >-
                      The provider that serves this operation does not support
                      OPERATION_BANKSLIP_PAYMENT, so nothing was recorded and
                      the provider was not called.
                    code: PBP-0701
                    capability: OPERATION_BANKSLIP_PAYMENT
                PBP-0220:
                  summary: 'PBP-0220: Presented boleto required'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0220
                    title: PRESENTED_BOLETO_REQUIRED
                    status: 422
                    detail: >-
                      Channel DDA requires a presented boleto that matches the
                      digitable line.
                    code: PBP-0220
          description: >-
            Unprocessable Entity.


            - `PBP-0300`: the funding account does not have enough available
            balance. The payment is recorded as `FAILED`. Nothing was sent or
            paid. The key is released: resend under the same or a new key once
            the balance allows.

            - `PBP-0302`: the funds reservation would take the funding account
            past its overdraft limit. The payment is recorded as `FAILED`.
            Nothing was sent or paid. The key is released.

            - `PBP-0014`: the provider refused the payment instruction. Nothing
            was paid and the reservation is cancelled. The key is consumed: fix
            the cause and send under a new `Idempotency-Key`.

            - `PBP-0212`: the provider refused the payment because it arrived
            outside its accepted hours. Nothing was paid. The key is consumed:
            send under a new `Idempotency-Key` once the provider accepts
            payments. Until the first reservation is released, you may get
            `PBP-0300`.

            - `PBP-0013`: the `Idempotency-Key` was already used for a different
            request (another body, digitable line, funding account,
            `X-Organization-Id` or `ledgerId`). Nothing was done. Send under a
            new key.

            - `PBP-0210`: the provider's check found the slip cannot be paid:
            already paid, cancelled, expired, or with an amount of zero or less.
            Nothing was created. It keeps returning this code until the slip
            changes.

            - `PBP-0111`: the slip's source refused it in the provider's check,
            for the reason whose provider code the `detail` names (for example a
            different amount). Nothing was created. Resend once the cause is
            fixed.

            - `PBP-0202`: account validation is not available on this
            deployment. No payment was created. Contact support.

            - `PBP-0017`: the provider account to pay from could not be
            established. Nothing was created or sent. A resend does not fix it.
            Contact support.

            - `PBP-0205`: the funding account owner's registration is
            inconsistent (invalid CPF or CNPJ, a tax id that contradicts the
            person type, or more than one owner), so the payer cannot be
            established. Fix the registration, then resend.

            - `PBP-0208`: the funding account owner's tax document is not
            numeric, for example an alphanumeric CNPJ. The provider accepts only
            a numeric CPF or CNPJ. No payment was created. Use an account whose
            owner has a numeric document.

            - `PBP-0700`: the tenant's provider route has no provider for
            `BANKSLIP_PAYMENT` or `BARCODE_BILL_PAYMENT`. Nothing was written
            and no provider was called.

            - `PBP-0701`: the routed provider does not declare a capability this
            request needs. The `capability` member names it:
            `OPERATION_BANKSLIP_PAYMENT`, `OPERATION_BARCODE_BILL_PAYMENT`,
            `PAYMENT_SEGMENT_BANKSLIP` or `PAYMENT_SEGMENT_UTILITIES`. Nothing
            was written and no provider was called.

            - Planned: `PBP-0220`: DDA (electronic payer): `channel` is `DDA`
            without a valid `receiverBoletoId`, or `digitableLine` is not the
            line of that presented boleto.


            See the [error
            list](/pt/reference/interfaces/payments-btg/payments-error-list) for
            every code.
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0002:
                  summary: 'PBP-0002: Unexpected failure'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0002
                    title: Internal Server Error
                    status: 500
                    detail: internal error
                    code: PBP-0002
          description: >-
            Internal Server Error.


            - `PBP-0002`: an unexpected failure. The payment may or may not
            exist, and in rare cases it may have been sent. A resend under the
            same key is safe: it gets `409` `PBP-0007` while the first request
            holds the key, then replays this `500` or runs the request again.
            Before you send under a new `Idempotency-Key`, look for the payment
            with `GET /v1/payments?idempotencyKey=`. If one is found, follow it
            with `GET /v1/payments/{id}` and do not resend. After you switch
            keys, never resend under the old one: it can run again after five
            minutes and pay alongside the new one.
        '502':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0113:
                  summary: 'PBP-0113: Unusable provider answer'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0113
                    title: Provider Unexpected Response
                    status: 502
                    detail: internal error
                    code: PBP-0113
          description: >-
            Bad Gateway. The `detail` is a fixed text.


            - `PBP-0113`: the provider's check of the slip returned an answer
            that cannot be used (no amount, an amount outside its declared
            limits, an error inside the answer, an unknown refusal reason or an
            unreadable body). A provider that does not answer gets `503`
            `PBP-0015` instead. Nothing was created. The key is released: resend
            under the same key.
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                PBP-0211:
                  summary: 'PBP-0211: Provider did not receive it'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0211
                    title: Payment Not Received By Provider
                    status: 503
                    detail: internal error
                    code: PBP-0211
                PBP-0015:
                  summary: 'PBP-0015: Provider unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0015
                    title: Provider Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0015
                PBP-0008:
                  summary: 'PBP-0008: Dependency unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0008
                    title: Service Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0008
                PBP-0206:
                  summary: 'PBP-0206: Owner records unavailable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0206
                    title: Owner Registry Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0206
                PBP-0706:
                  summary: 'PBP-0706: Counterparty unusable'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0706
                    title: Ledger Counterparty Unusable
                    status: 503
                    detail: internal error
                    code: PBP-0706
                PBP-0301:
                  summary: 'PBP-0301: Funds not reserved'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0301
                    title: Ledger Unavailable
                    status: 503
                    detail: internal error
                    code: PBP-0301
                PBP-0704:
                  summary: 'PBP-0704: Provider not available'
                  value:
                    type: https://errors.lerian.studio/v1/PBP-0704
                    title: PROVIDER_NOT_INSTALLED
                    status: 503
                    detail: internal error
                    code: PBP-0704
          description: >-
            Service Unavailable. The `detail` is a fixed text.


            - `PBP-0211`: the provider did not receive the instruction. Nothing
            was paid. The payment is recorded as failed and its reservation is
            cancelled. The key is consumed: send under a new `Idempotency-Key`.
            Until the first reservation is released, you may get `PBP-0300`.
            While the provider refuses these calls or they cannot be
            authenticated, every new attempt gets `PBP-0211` until an operator
            restores access.

            - `PBP-0015`: the provider's check of the slip gave no usable
            answer. Nothing was created. The key is released: resend under the
            same key.

            - `PBP-0008`: a dependency (authentication, storage or the provider
            route) is unavailable. Nothing was processed. Retry under the same
            `Idempotency-Key`.

            - `PBP-0206`: the records that identify the funding account owner
            (payer) could not be reached. No payment was created. Retry. If a
            resend under the same key returns `PBP-0002`, use a new key. If a
            new key returns this code again, contact support.

            - `PBP-0706`: the ledger account set as the provider's counterparty
            cannot be used. Nothing was reserved, sent or paid. The answer is
            stored under this key. Once the counterparty is fixed, send under a
            new `Idempotency-Key`. A payment the first request created may read
            `UNCONFIRMED` until it ends `FAILED`. It is never sent or paid.

            - `PBP-0301`: the funds could not be reserved, or the payment could
            not be recorded, before the provider was instructed. Nothing was
            sent or paid. Once the cause is fixed, send under a new
            `Idempotency-Key` and never reuse the old one. Find a payment the
            first request may have created with `GET
            /v1/payments?idempotencyKey=`. It reads `UNCONFIRMED` until it ends
            `FAILED`, and it is never paid. Until its reservation is released,
            the request under the new key may get `PBP-0300`.

            - `PBP-0704`: the routed provider is not installed on this
            deployment or not connected to the tenant. Nothing was written and
            no provider was called.
      security:
        - BearerAuth: []
components:
  schemas:
    InitiatePaymentRequest:
      additionalProperties: false
      properties:
        description:
          description: Free-text description carried on the payment.
          type: string
        digitableLine:
          description: Bankslip or utilities digitable line, digits only.
          examples:
            - 1.905009540144816e+44
          type: string
        ledgerId:
          description: >-
            Midaz ledger the account lives in and the entry is posted to.
            Required: absent, blank or not a canonical UUID is refused with 400
            PBP-0026.
          type: string
        midazAccountId:
          description: >-
            Midaz account the payment settles from. Who PAYS is the registered
            owner of this account, read from the Midaz CRM: the request does not
            state a payer.
          type: string
        amount:
          description: >-
            Optional amount to pay, a decimal string with two decimal places,
            for a slip that accepts partial or divergent payment. Absent: the
            amount the pre-payment consult calculates for today is paid, as
            before. Present: the provider must pay an informed amount (else 422
            PBP-0701, capability PAYMENT_AMOUNT_INFORMED) and the slip must
            accept it (else 422 PBP-0217); the accepted amount is the one
            reserved, reported to the clearing base and debited. Exactly two
            decimal places and greater than zero: zero (0.00) is refused by the
            pattern with 400 PBP-0001. Part of the request identity: the same
            Idempotency-Key with another amount is 422 PBP-0013.
          examples:
            - '100.00'
          maxLength: 32
          pattern: ^(0\.(0[1-9]|[1-9][0-9])|[1-9][0-9]{0,15}\.[0-9]{2})$
          type: string
          x-mint:
            post:
              - Under development
        channel:
          description: >-
            Optional channel through which the payer paid the slip. Absent: the
            tenant's default payment channel

            (INTERNET unless Lerian recorded another one at the tenant's
            request; the default can never be DDA). The value is fixed when the
            request is received and recorded with the payment. A value

            outside the enum is refused with 400 PBP-0001. DDA requires a
            bankslip presented to this payer through DDA (receiverBoletoId,

            delivered with the DDA payer flow); without it, 422 PBP-0220. Part
            of the request identity: the same Idempotency-Key with another

            channel is 422 PBP-0013.


            A provider that reports the channel to the clearing base sends the
            code below; a provider that does not (BTG) ignores it. Codes

            of the `CanPgto` domain, Manual de Leiautes da Plataforma
            Centralizada de Recebíveis (PCR), MAPX-OP016-2009 V63, §10.1:


            | channel | CanPgto | Manual description |

            |---|---|---|

            | BRANCH | 1 | Agências – Postos tradicionais |

            | ATM | 2 | Terminal de Autoatendimento |

            | INTERNET | 3 | Internet (home / office banking) |

            | BANKING_AGENT | 5 | Correspondente bancário |

            | CALL_CENTER | 6 | Central de atendimento (Call Center) |

            | ELECTRONIC_FILE | 7 | Arquivo Eletrônico |

            | DDA | 8 | DDA |

            | DIGITAL_BANKING_AGENT | 9 | Correspondente bancário digital |


            Code 4 (PIX) is not accepted: a slip paid through Pix is the BolePix
            flow, not this operation.
          enum:
            - BRANCH
            - ATM
            - INTERNET
            - BANKING_AGENT
            - CALL_CENTER
            - ELECTRONIC_FILE
            - DDA
            - DIGITAL_BANKING_AGENT
          examples:
            - INTERNET
          type: string
          x-mint:
            post:
              - Under development
        paymentMethod:
          description: >-
            Optional means of payment the payer used. Absent: the tenant's
            default payment method (ACCOUNT_DEBIT

            unless Lerian recorded another one at the tenant's request). The
            value is fixed when the request is received and recorded with the
            payment. A value outside the

            enum is refused with 400 PBP-0001. The payment is always debited
            from `midazAccountId`; this member only states the means reported

            to the clearing base. Part of the request identity: the same
            Idempotency-Key with another paymentMethod is 422 PBP-0013.


            A provider that reports the means of payment to the clearing base
            sends the code below; a provider that does not (BTG) ignores it.

            Codes of the `MeioPgto` domain, Manual de Leiautes da Plataforma
            Centralizada de Recebíveis (PCR), MAPX-OP016-2009 V63, §10.36:


            | paymentMethod | MeioPgto | Manual description |

            |---|---|---|

            | CASH | 1 | Espécie |

            | ACCOUNT_DEBIT | 2 | Débito em conta |

            | CREDIT_CARD | 3 | Cartão de crédito |

            | CHECK | 4 | Cheque |
          enum:
            - CASH
            - ACCOUNT_DEBIT
            - CREDIT_CARD
            - CHECK
          examples:
            - ACCOUNT_DEBIT
          type: string
          x-mint:
            post:
              - Under development
        receiverBoletoId:
          type: string
          format: uuid
          description: >-
            Presented boleto being paid. With channel DDA it must be presented
            to the holder of midazAccountId, and digitableLine must be that
            boleto's line; otherwise 422 PBP-0220, the payment code also
            returned when channel DDA comes without receiverBoletoId.
          x-mint:
            post:
              - Under development
        scheduledDate:
          $ref: '#/components/schemas/RequestedScheduledDate'
          x-mint:
            post:
              - Under development
      required:
        - digitableLine
        - midazAccountId
      type: object
    InitiatePaymentResponse:
      additionalProperties: false
      properties:
        amount:
          type: string
        createdAt:
          type: string
        digitableLine:
          type: string
        dueDate:
          type: string
        id:
          type: string
        ledgerId:
          description: Midaz ledger the payment was written with. Always present.
          type: string
        organizationId:
          description: Midaz organization the payment was written with. Always present.
          type: string
        providerId:
          description: >-
            Identifier the payment provider assigned to this payment. Quote it,
            together with providerRequestId, when you contact the provider about
            this payment. Absent while the payment is UNCONFIRMED (the 202
            answer): the provider has acknowledged nothing yet. Read the payment
            by id later to obtain it.
          type: string
        providerRequestId:
          description: >-
            Reference this API sent to the payment provider when it instructed
            the payment, exactly as sent. Which of providerId and
            providerRequestId the provider accepts for a lookup depends on the
            provider and on the payment type, so quote both when you contact the
            provider. Absent when the payment carries no such reference.
          type: string
        status:
          description: >-
            The payment's status when this answer was produced. CREATED on a 201
            for a new payment; UNCONFIRMED on a 202, while the outcome at the
            payment provider is unknown. A request already on record is answered
            with the payment's status at that moment, which may be any status a
            payment takes. A replay of the same Idempotency-Key serves the
            stored answer, whose status may since have changed: read the payment
            by id for its current state.
          type: string
        type:
          type: string
        scheduledDate:
          $ref: '#/components/schemas/RequestedScheduledDate'
          x-mint:
            post:
              - Under development
        effectiveScheduledDate:
          $ref: '#/components/schemas/EffectiveScheduledDate'
          x-mint:
            post:
              - Under development
        effectiveAfterDueDate:
          $ref: '#/components/schemas/EffectiveAfterDueDate'
          x-mint:
            post:
              - Under development
        amountIsEstimated:
          type: boolean
          description: >-
            Planned. `true` when `amount` is the value looked up at acceptance
            and not the final value; `false` in an immediate payment, where the
            instruction was already sent with that value.


            - In a scheduled payment it is `true` from creation. The final value
            is the one the execution on the scheduled day uses; read it with
            `GET /v1/payments/{id}` once `executedAt` is set.
          examples:
            - true
          x-mint:
            post:
              - Under development
      required:
        - id
        - type
        - status
        - digitableLine
        - amount
        - createdAt
        - organizationId
        - ledgerId
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    RequestedScheduledDate:
      type: string
      format: date
      description: >-
        Planned. Date on which you want the payment to run, `YYYY-MM-DD`, with
        no time or time zone. Without it, the payment runs immediately.


        - It is not the date the payment runs. On a non-business day the payment
        runs on `effectiveScheduledDate`: always read that field.

        - Valid window: `tomorrow ≤ scheduledDate ≤ min(dueDate, today + 30
        calendar days)`. Outside it, creation is refused with one of the window
        codes.

        - In the first phase, a date on a non-business day is refused with
        `PBP-0006`.
      examples:
        - '2026-09-16'
    EffectiveScheduledDate:
      type: string
      format: date
      description: >-
        Planned. Business day on which the payment runs, `YYYY-MM-DD`. Read this
        date to know when the money goes out.


        - Computed at acceptance as the first business day on or after
        `scheduledDate`. Equal to it when the requested date is a business day.

        - Fixed at acceptance: a later calendar change does not move it.

        - Only one thing moves it: when the provider refuses the execution for
        cutoff or time window, the payment is rescheduled to the next business
        day, up to the attempt limit. A rescheduled payment leaves the
        `effectiveScheduledDateFrom`/`effectiveScheduledDateTo` interval it was
        in and enters the next one.

        - Present only in scheduled payments. Absent in an immediate payment.
      examples:
        - '2026-09-14'
    EffectiveAfterDueDate:
      type: boolean
      description: >-
        Planned. `true` when the effective date rolled past the title's due
        date; `false` otherwise, including in an immediate payment.


        - The window is checked on the requested date (`tomorrow ≤ scheduledDate
        ≤ min(dueDate, today + 30 days)`). The roll to the next business day
        happens after that check, so it can pass the due date: a boleto due on a
        Saturday, scheduled for that day, runs on Monday.

        - This case is accepted, not refused, and has no error code. Use the
        field to warn whoever scheduled the payment.

        - If the title does not accept payment on the next business day without
        a change in value, the amount can rise. See `amountIsEstimated`.

        - In the first phase there is no roll: a requested date on a
        non-business day is refused with `PBP-0006`, so the field is always
        `false`.
      examples:
        - false
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: 'Never returned: the service drops the rejected value.'
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.