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

# Read an invoice at checkout

> Returns what the checkout page needs to show an invoice: your account's details, the invoice and the available payment methods. Takes no key; it runs in the payer's browser.




## OpenAPI

````yaml /api-reference/openapi.en.json get /pay/{slug}/invoices/{invoiceID}
openapi: 3.1.0
info:
  title: Infi API
  version: 0.0.1
  description: >
    The Infi REST API: catalog, customers, usage metering, subscriptions,

    invoices, payments and checkout.


    **Authentication.** Send your secret key as `Authorization: Bearer
    sk_test_…`

    (sandbox) or `sk_live_…` (production). The key prefix selects the
    environment.

    Checkout routes (`/pay/*`) and `/public/*` take no key: they run in the

    payer's browser.


    **Idempotency.** Every request that changes data requires an

    `Idempotency-Key` header. A retry with the same key returns the original

    response instead of running again.


    **Amounts.** Money and quantities travel as decimal strings (`"150.00"`,

    `"0.0001"`), never as floating-point numbers.


    **Errors.** The body carries `error_code` (stable, branch on it), `message`

    (for humans) and `tracer_id` (send it to support). Rate-limit and
    idempotency

    errors are nested under `error`, with `code` and `request_id`.
servers:
  - url: https://api-sandbox.beinfi.com
    description: Sandbox
  - url: https://api.beinfi.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Catalog
  - name: Customers
  - name: Metering
  - name: Subscriptions
  - name: Invoices
  - name: Payments
  - name: Checkout
  - name: Coupons
  - name: Billing
  - name: Account
  - name: Webhooks
  - name: Test account
  - name: Rail
  - name: Storefronts
paths:
  /pay/{slug}/invoices/{invoiceID}:
    get:
      tags:
        - Checkout
      summary: Read an invoice at checkout
      description: >
        Returns what the checkout page needs to show an invoice: your account's
        details, the invoice and the available payment methods. Takes no key; it
        runs in the payer's browser.
      operationId: getCheckoutSession
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: Your account's public identifier, as in checkout URLs.
        - name: invoiceID
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Invoice ID.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
          description: The invoice and payment options.
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security: []
components:
  schemas:
    CheckoutSession:
      type: object
      required:
        - merchant
        - invoice
        - testMode
        - paymentOptions
        - cardEnabled
        - cryptoEnabled
      properties:
        merchant:
          type: object
          required:
            - slug
            - name
          properties:
            slug:
              type: string
            name:
              type: string
            logoUrl:
              type: string
              format: uri
          description: Your account's name and look, as the payer sees them.
        invoice:
          $ref: '#/components/schemas/Invoice'
        testMode:
          type: boolean
          description: '`true` when the invoice is in sandbox: no real money moves.'
        paymentOptions:
          type: array
          items:
            $ref: '#/components/schemas/PublicPaymentOption'
          description: The payment methods available for this invoice.
        cardEnabled:
          type: boolean
          description: >-
            Whether card is available. Derived from `paymentOptions`; always
            present.
        cryptoEnabled:
          type: boolean
          description: Whether crypto payment is available on this checkout.
        paymentMethod:
          type: string
          enum:
            - pix
            - boleto
            - card
            - crypto
          description: >-
            Method of the confirmed payment. Present only once the invoice is
            paid.
        mandate:
          type: object
          required:
            - version
            - text
          properties:
            version:
              type: string
            text:
              type: string
          description: >-
            Authorization to save the card, which the payer must accept. Present
            only when card is available and the invoice is open. Send `version`
            as `consentTextVersion` when charging with `saveInstrument`.
      description: What the checkout page receives to show and charge an invoice.
    Invoice:
      type: object
      properties:
        id:
          type: string
          format: uuid
        customerId:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The customer's product enrollment id. Set on product, usage and
            subscription invoices.
        payerId:
          type:
            - string
            - 'null'
          format: uuid
          description: The paying customer's id. Set on one-off invoices.
        subscriptionId:
          type:
            - string
            - 'null'
          format: uuid
          description: The subscription that generated the invoice
        invoiceNumber:
          type:
            - string
            - 'null'
          description: Sequential invoice number
        status:
          type: string
          enum:
            - draft
            - open
            - paid
            - void
            - uncollectible
          description: >-
            `draft` (being built), `open` (issued, awaiting payment), `paid`,
            `void` (canceled) or `uncollectible` (written off).
        currency:
          type: string
          description: Currency, as an ISO 4217 code (`BRL`).
        subtotal:
          type: string
          description: Sum of line items before tax and discounts.
        tax:
          type: string
          description: Tax on the invoice.
        total:
          type: string
          description: The invoice's final amount.
        amountDue:
          type: string
          description: How much is still owed.
        periodStart:
          type:
            - string
            - 'null'
          format: date-time
          description: Start of the billed period
        periodEnd:
          type:
            - string
            - 'null'
          format: date-time
          description: End of the billed period
        dueDate:
          type:
            - string
            - 'null'
          format: date-time
          description: Due date.
        finalizedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the invoice was issued.
        paidAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the invoice was paid.
        successUrl:
          type:
            - string
            - 'null'
          description: Where checkout sends the buyer after payment.
        cancelUrl:
          type:
            - string
            - 'null'
          description: Where checkout sends the buyer if they back out.
        createdAt:
          type: string
          format: date-time
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceLineItem'
      description: >-
        What a customer owes: line items, totals and status. Status: `draft` →
        `open` → `paid`, or `void` / `uncollectible`.
    PublicPaymentOption:
      oneOf:
        - $ref: '#/components/schemas/PublicPixPaymentOption'
        - $ref: '#/components/schemas/PublicCardPaymentOption'
      description: >-
        A payment method the checkout can offer. It is a hint: availability is
        checked again at charge time.
    Error:
      type: object
      required:
        - message
        - error_code
        - tracer_id
      properties:
        message:
          type: string
          description: Human-readable sentence.
        error_code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable error code. Branch on it.
        tracer_id:
          type: string
          description: Request id. Include it when contacting support.
      description: >-
        The standard error body. It is flat (no `error` wrapper) and the trace
        id is `tracer_id`.
    NotFoundError:
      type: object
      required:
        - message
        - error_code
        - tracer_id
        - resource
      properties:
        message:
          type: string
        error_code:
          $ref: '#/components/schemas/ErrorCode'
        tracer_id:
          type: string
        resource:
          type: string
    RequestError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
            request_id:
              type: string
    InvoiceLineItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - usage
            - recurring
            - proration
            - credit
            - adjustment
            - commitment
            - manual
          description: >-
            `usage` (metered usage), `recurring` (recurring fee), `proration`
            (pro-rata adjustment for a mid-period change), `credit`,
            `adjustment` (usage that arrived after its period was already
            invoiced), `commitment` (top-up to the minimum commitment) or
            `manual` (free-form line).
        meterId:
          type:
            - string
            - 'null'
          format: uuid
          description: The meter the usage came from
        priceId:
          type:
            - string
            - 'null'
          format: uuid
          description: The price applied to this line.
        description:
          type: string
        quantity:
          type: string
          description: Quantity billed
        unitPrice:
          type:
            - string
            - 'null'
          description: Price per unit
        amount:
          type: string
          description: Line total
        proration:
          type: boolean
          description: '`true` when the line is a pro-rated amount.'
      description: One line on an invoice.
    PublicPixPaymentOption:
      type: object
      additionalProperties: false
      required:
        - method
        - flow
      properties:
        method:
          type: string
          const: pix
        flow:
          type: string
          const: pix
          description: How the payment is completed in the browser.
    PublicCardPaymentOption:
      type: object
      additionalProperties: false
      required:
        - method
        - provider
        - flow
        - supportsSavedInstrument
      properties:
        method:
          type: string
          const: card
        provider:
          type: string
          enum:
            - adyen
            - stripe
        flow:
          type: string
          enum:
            - adyen_session
            - stripe_payment_intent
          description: How the payment is completed in the browser.
        supportsSavedInstrument:
          type: boolean
          description: Whether the payer can save the card for future charges.
    ErrorCode:
      type: string
      examples:
        - internal_error
        - validation_failed
        - bad_request
        - unauthorized
        - forbidden
        - not_found
        - conflict
        - rate_limited
      description: >-
        Stable error code. The list is open: besides the generic codes, each
        area defines its own (`coupon_expired`, `insufficient_balance`,
        `version_not_draft`, `idempotency_key_reused`…). Handle a code you do
        not recognize by its HTTP status and show `message`; do not fail parsing
        the response.
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Malformed request.
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundError'
      description: Resource not found.
    RateLimited:
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
      description: Rate limit exceeded. `Retry-After` gives the wait in seconds.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your account's secret key: `Authorization: Bearer sk_test_…` or
        `sk_live_…`. Server-side only.

````