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

# Registrar un pago

> Registra un pago (total o parcial) sobre una cuota y recalcula los estados de la cuota y del crédito. Requiere **acceso total**.



## OpenAPI

````yaml /openapi.json post /api/installments/{installmentId}/payments
openapi: 3.1.0
info:
  title: FinUp API
  version: 1.0.0
  description: >-
    API para que sistemas externos (ERP, CRM, scripts) operen sobre un negocio
    de FinUp: clientes, créditos, cuotas, pagos, sucursales, configuraciones,
    reportes y auditoría.


    Autenticación con **API key** del negocio (ver
    [Authentication](/api/authentication)), enviada como `Authorization: Bearer
    <clave>` o como header `X-API-Key: <clave>`. El alcance de la clave es
    **solo lectura** (`read`: únicamente métodos seguros `GET`/`HEAD`/`OPTIONS`)
    o **acceso total** (`full`: lectura y escritura).


    Quedan fuera de este contrato los endpoints de sesión web (p. ej. `GET
    /api/me` y `/api/admin/*`) y los públicos (p. ej. `POST /api/leads`); no se
    invocan con una API key.
servers:
  - url: https://api.finup.ar
    description: Producción
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Clientes
    description: Alta, edición y consulta de clientes.
  - name: Créditos
    description: Créditos y sus cuotas.
  - name: Pagos
    description: Registro de pagos y movimientos (ledger).
  - name: Configuraciones
    description: Planes de crédito.
  - name: Sucursales
    description: Sucursales del negocio.
  - name: Usuarios
    description: Usuarios internos (empleados y administradores).
  - name: Reportes
    description: Exportaciones y resumen.
  - name: Auditoría
    description: Registro de cambios.
  - name: Verificación
    description: Consulta ARCA (ex AFIP) y BCRA.
  - name: Archivos
    description: Documentación adjunta de clientes.
  - name: API keys
    description: Administración de claves de la API.
paths:
  /api/installments/{installmentId}/payments:
    parameters:
      - $ref: '#/components/parameters/InstallmentId'
    post:
      tags:
        - Pagos
      summary: Registrar un pago
      description: >-
        Registra un pago (total o parcial) sobre una cuota y recalcula los
        estados de la cuota y del crédito. Requiere **acceso total**.
      operationId: registerPayment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
              properties:
                amount:
                  type: number
                  description: Monto pagado (mayor a 0).
      responses:
        '201':
          description: Pago registrado y cuotas actualizadas.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    InstallmentId:
      name: installmentId
      in: path
      required: true
      description: ID de la cuota.
      schema:
        type: string
        format: uuid
  schemas:
    PaymentResult:
      type: object
      properties:
        payment:
          $ref: '#/components/schemas/LedgerEntry'
        installments:
          type: array
          items:
            $ref: '#/components/schemas/Installment'
    LedgerEntry:
      type: object
      properties:
        id:
          type: string
          format: uuid
        installment_id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - installment
            - punitory
            - payment
        amount:
          type: number
        branch_id:
          type:
            - string
            - 'null'
          format: uuid
        created_by:
          type: string
        created_at:
          type: string
          format: date-time
    Installment:
      type: object
      properties:
        id:
          type: string
          format: uuid
        credit_id:
          type: string
          format: uuid
        number:
          type: integer
        amount:
          type: number
        due_date:
          type: string
          format: date
        status:
          type: string
          enum:
            - pending
            - partial
            - paid
        overdue:
          type: boolean
        days_late:
          type: integer
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  responses:
    BadRequest:
      description: Datos inválidos.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: API key ausente o inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: La clave es de solo lectura o no tiene permisos para esta acción.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: El recurso no existe o no pertenece al negocio.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key del negocio enviada como `Authorization: Bearer <clave>`. El
        alcance `read` solo permite métodos seguros (`GET`/`HEAD`/`OPTIONS`);
        `full` permite además escribir.
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Alternativa a `Authorization: Bearer`: la misma API key del negocio en
        el header `X-API-Key`. Aplica la misma regla de alcance por método
        (`read` = solo `GET`/`HEAD`/`OPTIONS`).

````