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

# Mark an invoice as paid

> Record an external payment for the entire remaining balance of a finalized invoice. The amount
must match the remaining balance.



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json post /api/v1/invoices/{invoice_id}/mark-paid
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Meteroid-EE
    identifier: LicenseRef-Meteroid-EE
  version: 0.1.0
servers: []
security: []
tags:
  - name: Add-ons
  - name: Batch Jobs
  - name: Budgets
    description: >-
      Beta: may change before general availability. Spending limits on a
      customer's usage, or one subscription's, per currency, with alerts at
      percentages of the amount.
    x-beta: true
  - name: Checkout Sessions
  - name: Checks
    description: >-
      Beta: may change before general availability. Whether a customer may
      consume more of a feature right now.
    x-beta: true
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Credit units
    description: >-
      Custom denominations, such as "credits", that usage can be priced in and
      credit granted or sold in, instead of money.
  - name: Credits
    description: >-
      Prepaid credit: a customer's wallets, credit grants, ledger and top-ups.
      Promotional credit applies before tax like a discount; paid credit applies
      after tax like a payment.
  - name: Custom Properties
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - name: Licenses
    description: >-
      Licenses for your customers' self-hosted installations: signed tokens
      carrying their plan's entitlements, activated and refreshed by the
      installation over the public licensing endpoints.
  - name: Metrics
  - name: OAuth
    description: OAuth 2.0 token endpoints (public, client-credentials auth)
  - name: OAuth Apps
    description: Manage OAuth applications for Connect integrations
  - name: Plans
  - name: Product Families
  - name: Products
  - name: Subscriptions
  - name: Usage
  - name: Usage costs
    description: >-
      Beta: may change before general availability. A customer's or a
      subscription's usage events and usage over time, with what they cost.
    x-beta: true
  - name: Webhook Endpoints
    description: Manage outbound webhook endpoints and inspect their deliveries
paths:
  /api/v1/invoices/{invoice_id}/mark-paid:
    post:
      tags:
        - Invoices
      summary: Mark an invoice as paid
      description: >-
        Record an external payment for the entire remaining balance of a
        finalized invoice. The amount

        must match the remaining balance.
      operationId: mark_invoice_paid
      parameters:
        - name: invoice_id
          in: path
          description: Invoice ID
          required: true
          schema:
            $ref: '#/components/schemas/InvoiceId'
        - name: Idempotency-Key
          in: header
          description: Required; reuse it only to retry the same request
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordInvoicePaymentRequest'
        required: true
      responses:
        '201':
          description: Recorded payment of the remaining balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        '400':
          description: Invalid request or invoice cannot be marked paid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '404':
          description: Invoice not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '409':
          description: Idempotency-Key reused with another request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    InvoiceId:
      type: string
      format: MeteroidId
      examples:
        - inv_7n42DGM5Tflk9n8mt7Fhc7
    RecordInvoicePaymentRequest:
      type: object
      required:
        - amount
      properties:
        amount:
          type: integer
          format: int64
          description: >-
            The positive amount received, in minor units of the invoice currency
            (e.g. cents).
          example: 1250
          minimum: 1
        paid_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the payment was received, at most a day ahead. Defaults to the
            current time.
        reference:
          type:
            - string
            - 'null'
          description: Reference for the external payment, such as a bank transfer ID.
    Transaction:
      type: object
      required:
        - id
        - amount
        - currency
        - status
        - payment_type
        - amount_refunded
        - amount_reversed
      properties:
        amount:
          type: integer
          format: int64
          minimum: 0
        amount_disputed:
          type: integer
          format: int64
          description: >-
            On a PAYMENT: the part of `amount_reversed` lost to disputes or
            chargebacks. The invoice

            stays paid; only the rest of `amount_reversed` (a failed collection)
            reopens it.
        amount_refunded:
          type: integer
          format: int64
          description: >-
            On a PAYMENT: how much was voluntarily given back (the sum of its
            settled REFUND

            children). The invoice stays paid — the Refund credit note is what
            reduces it.
        amount_reversed:
          type: integer
          format: int64
          description: >-
            On a PAYMENT: how much was involuntarily clawed back (chargeback,
            bank recall, lost

            dispute). This is what the invoice nets out, reopening it.
        amount_reversed_excess:
          type: integer
          format: int64
          description: >-
            On a PAYMENT: what the provider withdrew above what the payment
            still held (refunded

            before). Never applied to the invoice or credit: contest it with the
            provider.
        credit_note_id:
          oneOf:
            - $ref: '#/components/schemas/CreditNoteId'
              description: Set on a REFUND drawn against a finalized Refund credit note.
            - type: 'null'
        currency:
          type: string
        error:
          type:
            - string
            - 'null'
        id:
          $ref: '#/components/schemas/PaymentTransactionId'
        parent_transaction_id:
          oneOf:
            - $ref: '#/components/schemas/PaymentTransactionId'
              description: >-
                Set on a REFUND: the settled payment the money is given back
                from.
            - type: 'null'
        payment_method_id:
          oneOf:
            - $ref: '#/components/schemas/CustomerPaymentMethodId'
            - type: 'null'
        payment_method_info:
          oneOf:
            - $ref: '#/components/schemas/PaymentMethodInfo'
            - type: 'null'
        payment_type:
          $ref: '#/components/schemas/PaymentTypeEnum'
        processed_at:
          type:
            - string
            - 'null'
          format: date-time
        provider_transaction_id:
          type:
            - string
            - 'null'
        refund_mode:
          oneOf:
            - $ref: '#/components/schemas/RefundMode'
            - type: 'null'
        reversal_kind:
          oneOf:
            - $ref: '#/components/schemas/ReversalKind'
            - type: 'null'
        reversal_reason:
          type:
            - string
            - 'null'
          description: >-
            The provider's raw cause, or what the operator typed when reversing
            by hand.
        status:
          $ref: '#/components/schemas/PaymentStatusEnum'
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    CreditNoteId:
      type: string
      format: MeteroidId
      examples:
        - crn_7n42DGM5Tflk9n8mt7Fhc7
    PaymentTransactionId:
      type: string
      format: MeteroidId
      examples:
        - pay_7n42DGM5Tflk9n8mt7Fhc7
    CustomerPaymentMethodId:
      type: string
      format: MeteroidId
      examples:
        - pm_7n42DGM5Tflk9n8mt7Fhc7
    PaymentMethodInfo:
      type: object
      required:
        - payment_method_type
      properties:
        account_number_hint:
          type:
            - string
            - 'null'
        card_brand:
          type:
            - string
            - 'null'
        card_last4:
          type:
            - string
            - 'null'
        payment_method_type:
          $ref: '#/components/schemas/PaymentMethodTypeEnum'
    PaymentTypeEnum:
      type: string
      enum:
        - PAYMENT
        - REFUND
    RefundMode:
      type: string
      description: >-
        How a voluntary refund was issued: through the provider, or recorded
        after a wire or cash

        movement made outside Meteroid.
      enum:
        - ONLINE
        - OFFLINE
    ReversalKind:
      type: string
      description: Why a payment was involuntarily clawed back.
      enum:
        - REFUND
        - CHARGEBACK
        - DEBTOR_RECALL
        - INSUFFICIENT_FUNDS
        - MANDATE_INVALID
        - RETURNED
        - DISPUTE
        - OTHER
    PaymentStatusEnum:
      type: string
      enum:
        - READY
        - PENDING
        - SETTLED
        - CANCELLED
        - FAILED
        - REFUNDED
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOKEN_EXPIRED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
    PaymentMethodTypeEnum:
      type: string
      enum:
        - CARD
        - BANK_TRANSFER
        - WALLET
        - OTHER
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````

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