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

# Plan payment allocation

> Previews how an amount would settle a customer’s pending invoices, oldest due first, without applying it.



## OpenAPI

````yaml /openapi.yaml post /v1/payment-allocation-plans
openapi: 3.1.0
info:
  title: Quentli REST API
  version: 1.0.0
  description: OpenAPI spec for Quentli REST endpoints.
servers:
  - url: https://api.quentli.com
    description: Production API
  - url: https://api.staging.quentli.com
    description: Staging API for production-like validation
security:
  - organizationApiKey: []
  - oauthAccessToken: []
tags:
  - name: Auth
  - name: Management
  - name: Billing
  - name: Catalog
  - name: Customers
  - name: Invoices
  - name: Payment Methods
  - name: Payment Sessions
  - name: Payments
  - name: Subscriptions
  - name: Tax Invoices
  - name: Webhooks
  - name: Messaging
paths:
  /v1/payment-allocation-plans:
    post:
      tags:
        - Payments
      summary: Plan payment allocation
      description: >-
        Previews how an amount would settle a customer’s pending invoices,
        oldest due first, without applying it.
      operationId: payments_plan_invoice_allocations
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanPaymentInvoiceAllocationsArgs'
      responses:
        '200':
          description: Planned invoice allocations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlanPaymentInvoiceAllocationsResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    PlanPaymentInvoiceAllocationsArgs:
      type: object
      properties:
        input:
          type: object
          properties:
            customerId:
              type: string
              minLength: 1
            currency:
              type: string
            amount:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
          required:
            - customerId
            - currency
            - amount
      required:
        - input
      description: Request body for planning how a payment would settle pending invoices.
    PlanPaymentInvoiceAllocationsResponse:
      type: array
      items:
        type: object
        properties:
          invoiceId:
            type: string
            description: Identifier of the pending invoice.
            example: inv_1234567890abcdefghij
          dueDate:
            type: string
            format: date-time
            description: When the invoice is due.
          currency:
            type: string
            description: ISO 4217 currency code.
            example: MXN
          totalAmount:
            type: integer
            description: Invoice total, in minor units.
            example: 150000
          amountPaid:
            type: integer
            description: Amount already paid, in minor units.
            example: 0
          settledAmount:
            type: integer
            description: Amount the payment would settle on this invoice, in minor units.
            example: 150000
        required:
          - invoiceId
          - dueDate
          - currency
          - totalAmount
          - amountPaid
          - settledAmount
      description: >-
        Pending invoices, oldest due first, and the amount a payment would
        settle on each.
    UserError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
      additionalProperties: false
      description: Standard user-facing error response envelope.
  securitySchemes:
    organizationApiKey:
      type: http
      scheme: bearer
      description: 'Organization API key using `Authorization: Bearer sk_...`.'
    oauthAccessToken:
      type: http
      scheme: bearer
      bearerFormat: OAuth 2.1
      description: 'OAuth access token using `Authorization: Bearer qoa_at_...`.'

````

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