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

# Create an invoice

> Creates a one-off invoice for a customer, in the `live` or `test` mode of the API key used. The invoice is not tied to a subscription and starts in `draft` status. Fintoc does not charge the invoice until you finalize it. The `total` is the sum of the `lines`, which must all share the same `currency`. Fintoc charges the invoice automatically against `default_payment_method`, so `collection_method` is always `charge_automatically`.

**`v2`** · Base URL `https://api.fintoc.com/v2`


## OpenAPI

````yaml reference/fintoc-api-v2.json POST /invoices
openapi: 3.1.0
info:
  title: fintoc-api-v2
  version: v2026-02-01
servers:
  - url: https://api.fintoc.com/v2
security: []
paths:
  /invoices:
    post:
      tags:
        - Invoices
      summary: Create an invoice
      description: >-
        Creates a one-off invoice for a customer, in the `live` or `test` mode
        of the API key used. The invoice is not tied to a subscription and
        starts in `draft` status. Fintoc does not charge the invoice until you
        finalize it. The `total` is the sum of the `lines`, which must all share
        the same `currency`. Fintoc charges the invoice automatically against
        `default_payment_method`, so `collection_method` is always
        `charge_automatically`.
      operationId: invoices-create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: string
                  description: ID of the customer the invoice bills.
                  example: cus_2c4mDe9NJyGmMzvCqLkXqAtjnRu
                default_payment_method:
                  type: string
                  description: >-
                    Payment method Fintoc charges when the invoice is finalized.
                    Must belong to the specified `customer`.
                  example: pm_2c4mDhAbCdEfGhIjKlMnOpQrStu
                lines:
                  type: array
                  minItems: 1
                  description: >-
                    Line items the invoice bills for. All lines must share the
                    same `currency`, which becomes the invoice currency.
                  items:
                    type: object
                    properties:
                      amount:
                        type: integer
                        description: >-
                          Total amount of the line, in the currency's smallest
                          unit. `CLP` has no minor unit, so `60000` is 60,000
                          CLP.
                        example: 60000
                      currency:
                        type: string
                        enum:
                          - CLP
                          - MXN
                        description: >-
                          Three-letter ISO 4217 currency code, in uppercase. One
                          of `CLP` or `MXN`.
                        example: CLP
                      name:
                        type: string
                        description: Short name of the line.
                        example: Design
                      description:
                        type: string
                        description: Longer description of the line.
                        example: Design work
                      quantity:
                        type: integer
                        description: >-
                          Number of units the line bills for. Must be greater
                          than 0.
                        example: 1
                    required:
                      - amount
                      - currency
                      - name
                      - quantity
                collection_method:
                  type: string
                  enum:
                    - charge_automatically
                  description: >-
                    How Fintoc collects the invoice. Only `charge_automatically`
                    is supported. Defaults to `charge_automatically`.
                  example: charge_automatically
                metadata:
                  type: object
                  description: Set of key-value pairs you can attach to the invoice.
                  example:
                    order_id: '12345'
              required:
                - customer
                - default_payment_method
                - lines
      responses:
        '201':
          description: The created invoice, in `draft` status.
          content:
            application/json:
              examples:
                invoice_created:
                  value:
                    id: inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
                    object: invoice
                    attempt_count: 0
                    created_at: '2026-05-01T12:00:00Z'
                    currency: CLP
                    customer: cus_2c4mDe9NJyGmMzvCqLkXqAtjnRu
                    default_payment_method: pm_2c4mDhAbCdEfGhIjKlMnOpQrStu
                    hosted_invoice_url: null
                    lines:
                      - id: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
                        object: line_item
                        name: Design
                        description: Design work
                        amount: 60000
                        currency: CLP
                        period_end: null
                        period_start: null
                        quantity: 2
                      - id: il_2bVdX1QrKt7SiOvAGnAmUp3FzLr
                        object: line_item
                        name: Hosting
                        description: Hosting
                        amount: 40000
                        currency: CLP
                        period_end: null
                        period_start: null
                        quantity: 1
                    metadata:
                      order_id: '12345'
                    mode: live
                    next_payment_attempt_at: null
                    payments: []
                    status: draft
                    subscription: null
                    total: 100000
              schema:
                $ref: '#/components/schemas/invoice'
        '400':
          description: Invalid request.
          content:
            application/json:
              examples:
                invalid_collection_method:
                  value:
                    error:
                      type: invalid_request_error
                      code: invalid_collection_method
                      message: 'collection_method must be one of: charge_automatically'
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              examples:
                invalid_api_key:
                  value:
                    error:
                      type: authentication_error
                      code: invalid_api_key
                      message: 'Invalid API Key: invalid-*oken'
              schema:
                $ref: '#/components/schemas/error_object'
        '404':
          description: >-
            The customer does not exist, or the payment method does not exist or
            does not belong to the customer.
          content:
            application/json:
              examples:
                payment_method_not_found:
                  value:
                    error:
                      type: invalid_request_error
                      code: missing_resource
                      message: 'No such payment_method: pm_2c4mDhAbCdEfGhIjKlMnOpQrStu'
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object'
        '409':
          description: >-
            The currency is not allowed for the organization's country. Chilean
            organizations bill in `CLP` and Mexican organizations bill in `MXN`.
          content:
            application/json:
              examples:
                currency_mismatch:
                  value:
                    error:
                      type: invalid_request_error
                      code: currency_mismatch
                      message: >-
                        The currency is not allowed for the organization's
                        country
                      doc_url: https://docs.fintoc.com/reference/errors
              schema:
                $ref: '#/components/schemas/error_object'
      security:
        - api_key: []
components:
  schemas:
    invoice:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the invoice.
          example: inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
        hosted_invoice_url:
          type:
            - string
            - 'null'
          description: >-
            URL of the hosted invoice page, where your customer can view and pay
            the invoice. `null` for `test` mode invoices and for invoices that
            are not `open`.
          example: >-
            https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe
        object:
          const: invoice
          description: Type of the object. Always `invoice`.
        attempt_count:
          type: integer
          description: >-
            Number of automatic charge attempts Fintoc has made on the invoice.
            `0` until the invoice is finalized and charged for the first time.
          example: 1
        created_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp of when the invoice was created.
          example: '2026-05-01T12:00:00Z'
        currency:
          type: string
          enum:
            - CLP
            - MXN
          description: >-
            Currency of the invoice, as an ISO 4217 code. Every line item uses
            this currency.
          example: CLP
        customer:
          type: string
          description: '`id` of the customer the invoice bills.'
          example: cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo
        default_payment_method:
          type:
            - string
            - 'null'
          description: >-
            `id` of the payment method Fintoc charges when the invoice is
            finalized. `null` for invoices without one, such as subscription
            invoices.
          example: pm_2c4mDhAbCdEfGhIjKlMnOpQrStu
        lines:
          type: array
          description: Line items that make up the invoice total.
          items:
            $ref: '#/components/schemas/invoice_line_item'
        metadata:
          type:
            - object
            - 'null'
          description: >-
            Set of key-value pairs attached to the invoice. `null` when the
            invoice has no metadata.
        mode:
          type: string
          enum:
            - live
            - test
          description: >-
            Mode of the invoice. `live` invoices use real data; `test` invoices
            use fake data for integration testing. An API key only sees invoices
            that share its mode.
          example: live
        next_payment_attempt_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 timestamp of the next scheduled automatic charge attempt.
            `null` when no further attempt is scheduled.
          example: '2026-05-02T12:00:00Z'
        payments:
          type: array
          description: Payment attempts to collect the invoice.
          items:
            type: object
            properties:
              amount:
                type: integer
                description: >-
                  Amount of the payment, in the smallest unit of `currency` (for
                  example, `30000` for $30000 CLP, since CLP has no minor unit,
                  or `3000` for $30.00 MXN).
                example: 30000
              currency:
                type: string
                enum:
                  - CLP
                  - MXN
                description: >-
                  Currency of the payment, as an ISO 4217 code. Always matches
                  the invoice currency.
                example: CLP
              payment_intent:
                type: string
                description: '`id` of the payment intent created to collect the invoice.'
                example: pi_2bVdX2RsLu8TjPwBHoBnVq4G0Ms
              status:
                type: string
                enum:
                  - pending
                  - succeeded
                  - failed
                description: Status of the payment attempt.
                example: succeeded
            required:
              - amount
              - currency
              - payment_intent
              - status
        status:
          type: string
          enum:
            - draft
            - open
            - paid
            - void
          description: >-
            Status of the invoice. Invoices start as `draft`, become `open` when
            finalized, and end as `paid` or `void`.
          example: draft
        subscription:
          type:
            - string
            - 'null'
          description: >-
            `id` of the subscription that generated the invoice. `null` for
            invoices not tied to a subscription.
          example: sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp
        total:
          type: integer
          description: >-
            Total amount of the invoice, in the smallest unit of `currency` (for
            example, `30000` for $30000 CLP, since CLP has no minor unit, or
            `3000` for $30.00 MXN). Equals the sum of the line item amounts.
          example: 30000
      required:
        - id
        - hosted_invoice_url
        - object
        - attempt_count
        - created_at
        - currency
        - customer
        - default_payment_method
        - lines
        - metadata
        - mode
        - next_payment_attempt_at
        - payments
        - status
        - subscription
        - total
    error_object:
      type: object
      properties:
        error:
          type: object
          description: Details of the error that caused the request to fail.
          properties:
            code:
              type: string
              description: >-
                Machine-readable code identifying the specific error, for
                example `invalid_api_key`. Not returned by every error.
              example: invalid_api_key
            doc_url:
              type: string
              description: >-
                URL of a documentation page with more details about the error.
                Not returned by every error.
              example: https://docs.fintoc.com/reference/errors
            message:
              type: string
              description: Human-readable message describing the error.
              example: 'Invalid API Key: invalid-*oken'
            param:
              type:
                - string
                - 'null'
              description: >-
                Name of the request parameter that caused the error. `null` when
                the error cannot be tied to a single parameter, and not returned
                by every error.
              example: amount
            type:
              type: string
              description: >-
                Category of the error, for example `invalid_request_error`,
                `authentication_error`, or `api_error`.
              example: invalid_request_error
          required:
            - type
            - message
    invoice_line_item:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the line item.
          example: il_2bVdX0PqJs6RhNu9FmZlTo2EyKq
        object:
          const: line_item
          description: Type of the object. Always `line_item`.
        amount:
          type: integer
          description: >-
            Amount of the line item, in the smallest unit of `currency` (for
            example, `30000` for $30000 CLP, since CLP has no minor unit, or
            `3000` for $30.00 MXN).
          example: 30000
        currency:
          type: string
          enum:
            - CLP
            - MXN
          description: >-
            Currency of the line item, as an ISO 4217 code. Always matches the
            invoice currency.
          example: CLP
        description:
          type:
            - string
            - 'null'
          description: >-
            Additional details about the line item shown on the invoice. `null`
            when the line item has no description.
          example: A premium plan
        name:
          type: string
          description: Display name for the line item shown on the invoice.
          example: Premium Plan
        period_end:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 datetime in UTC marking the end of the billing period
            covered by the line item. `null` for line items on invoices not tied
            to a subscription.
          example: '2026-06-01T00:00:00Z'
        period_start:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            ISO 8601 datetime in UTC marking the start of the billing period
            covered by the line item. `null` for line items on invoices not tied
            to a subscription.
          example: '2026-05-01T00:00:00Z'
        quantity:
          type: integer
          description: Number of units billed by the line item.
          example: 1
      required:
        - id
        - object
        - name
        - description
        - amount
        - currency
        - period_end
        - period_start
        - quantity
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header

````