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

# Add payment to a sale



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json post /v1/sales/{id}/payments
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: '## Flextell API'
servers:
  - url: https://dev.flextell.ai/api
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/sales/{id}/payments:
    post:
      tags:
        - Sales
      summary: Add payment to a sale
      operationId: sales.addPayment
      parameters:
        - name: id
          in: path
          required: true
          description: The sale identifier
          schema:
            type: integer
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SalePaymentRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      sale_id:
                        type: string
                      remaining_balance:
                        type: string
                      transaction:
                        type: object
                        properties:
                          id:
                            type: string
                          type:
                            type: string
                          credit:
                            type: string
                          debit:
                            type: string
                          currency_id:
                            type: string
                          exchange_rate:
                            type: string
                          description:
                            type: string
                        required:
                          - id
                          - type
                          - credit
                          - debit
                          - currency_id
                          - exchange_rate
                          - description
                    required:
                      - sale_id
                      - remaining_balance
                      - transaction
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                    const: Sale not found
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        const: Sale not found
                    required:
                      - message
                  errors:
                    type: 'null'
                required:
                  - success
                  - error
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    SalePaymentRequest:
      type: object
      properties:
        amount:
          type: number
          description: Monetary amount.
          minimum: 0.01
        currency_id:
          type:
            - integer
            - 'null'
          description: Filter by currency ID.
        exchange_rate:
          type:
            - number
            - 'null'
          description: Currency exchange rate.
          minimum: 0
        transaction_date:
          type:
            - string
            - 'null'
          format: date-time
          description: Transaction date (YYYY-MM-DD).
        type:
          type:
            - string
            - 'null'
          description: Filter by type.
          enum:
            - collection
            - payment
        description:
          type:
            - string
            - 'null'
          description: The description.
          maxLength: 65535
        account_id:
          type:
            - integer
            - 'null'
          description: Account ID.
      required:
        - amount
      title: SalePaymentRequest
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````