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

# Record Payment

> Finance confirms receipt of payment against an invoice.



## OpenAPI

````yaml /openapi/payment.yaml post /api/v1/invoices/{invoice_id}/payments
openapi: 3.1.0
info:
  title: Cape Media - Payment Service
  description: >-
    Invoice requests, invoice uploads, payment tracking, and commission
    management.
  version: 1.0.0
servers:
  - url: https://api.capedigital.co.ke/payment
    description: Production
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /api/v1/invoices/{invoice_id}/payments:
    post:
      tags:
        - Payments
      summary: Record Payment
      description: Finance confirms receipt of payment against an invoice.
      operationId: record_payment_api_v1_invoices__invoice_id__payments_post
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Invoice Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    PaymentCreate:
      properties:
        amount_paid:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
          title: Amount Paid
          description: Amount received in this payment. Must be greater than zero.
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
          description: 'Channel used: RTGS, EFT, MPESA, CHEQUE, INTERNAL_LEDGER, or OTHER.'
        payment_reference:
          type: string
          title: Payment Reference
          description: >-
            Bank reference, M-PESA transaction ID, or cheque number for audit
            trail.
        payment_date:
          type: string
          format: date
          title: Payment Date
          description: Date funds were received, e.g. '2026-05-31'.
        document_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Document Id
          description: >-
            ID of the payment receipt uploaded to document-service (bank advice,
            M-PESA confirmation, cheque scan, etc.). Upload to document-service
            first, then pass the ID here.
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
          description: Optional internal notes for the finance team.
      type: object
      required:
        - amount_paid
        - payment_method
        - payment_reference
        - payment_date
      title: PaymentCreate
      description: |-
        Records a payment receipt against an invoice.

        **Endpoint:** `POST /api/v1/invoices/{invoice_id}/payments`
        **Required role:** `finance:confirm_payment`

        Multiple payments can be recorded against the same invoice to support
        installment/partial payment workflows.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PaymentMethod:
      type: string
      enum:
        - RTGS
        - EFT
        - MPESA
        - CHEQUE
        - INTERNAL_LEDGER
        - OTHER
      title: PaymentMethod
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````