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

# Get an invoice by ID

> Retrieves a specific subscription invoice by its unique identifier, including associated subscription details.



## OpenAPI

````yaml /api-reference/orchestrator-openapi.json get /v1/subscription-invoices/{id}
openapi: 3.0.0
info:
  title: Payment Orchestrator API
  description: API documentation for the Payment Orchestrator service
  version: 1.0.0
servers:
  - url: https://api.sandbox.cheqpay.mx/pos
    description: Sandbox environment
  - url: https://prod.cheqpay.mx/pos
    description: Production environment
security:
  - ApiKeyAuth: []
    MerchantIdAuth: []
tags:
  - name: Customer
    description: Customer management endpoints (v1)
  - name: Customer V2
    description: >-
      Customer management endpoints (v2) - merchant-scoped, no external ID
      required
  - name: Payment Order
    description: Payment order management endpoints
  - name: Checkout
    description: Payment checkout endpoints
  - name: Payment Method
    description: Payment method management endpoints
  - name: Subscription Plan
    description: Subscription plan management endpoints for recurring payments
  - name: Subscription
    description: Subscription management endpoints for recurring billing
  - name: Subscription Invoice
    description: Subscription invoice management endpoints
paths:
  /v1/subscription-invoices/{id}:
    get:
      tags:
        - Subscription Invoice
      summary: Get an invoice by ID
      description: >-
        Retrieves a specific subscription invoice by its unique identifier,
        including associated subscription details.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Invoice unique identifier
      responses:
        '200':
          description: Invoice retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionInvoiceResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '404':
          description: Invoice not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalError'
components:
  schemas:
    SubscriptionInvoiceResponse:
      type: object
      required:
        - id
        - subscriptionId
        - amount
        - currency
        - status
        - periodStart
        - periodEnd
        - dueDate
        - attemptCount
        - maxRetries
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique invoice identifier
          example: 123e4567-e89b-12d3-a456-426614174000
        subscriptionId:
          type: string
          format: uuid
          description: Associated subscription ID
          example: 123e4567-e89b-12d3-a456-426614174001
        paymentOrderId:
          type: string
          format: uuid
          nullable: true
          description: Associated payment order ID
          example: 123e4567-e89b-12d3-a456-426614174002
        amount:
          type: string
          description: Invoice amount in smallest currency unit
          example: '9900'
        currency:
          type: string
          description: Currency code
          example: MXN
        status:
          type: string
          enum:
            - DRAFT
            - OPEN
            - PAID
            - VOID
            - UNCOLLECTIBLE
          description: Invoice status
          example: PAID
        periodStart:
          type: string
          format: date-time
          description: Billing period start
          example: '2025-01-01T00:00:00.000Z'
        periodEnd:
          type: string
          format: date-time
          description: Billing period end
          example: '2025-02-01T00:00:00.000Z'
        dueDate:
          type: string
          format: date-time
          description: Payment due date
          example: '2025-01-01T00:00:00.000Z'
        paidAt:
          type: string
          format: date-time
          nullable: true
          description: When the invoice was paid
          example: '2025-01-01T12:00:00.000Z'
        attemptCount:
          type: integer
          description: Number of payment attempts
          example: 1
        maxRetries:
          type: integer
          description: Maximum number of retry attempts
          example: 3
        nextRetryAt:
          type: string
          format: date-time
          nullable: true
          description: Next retry attempt date
          example: null
        lastFailureReason:
          type: string
          nullable: true
          description: Reason for the last failed payment attempt
          example: null
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
          example: '2025-01-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: '2025-01-01T12:00:00.000Z'
        subscription:
          type: object
          description: Associated subscription details
          properties:
            id:
              type: string
              format: uuid
              description: Subscription identifier
            customerId:
              type: string
              format: uuid
              description: Customer identifier
            planId:
              type: string
              format: uuid
              description: Plan identifier
            status:
              type: string
              description: Subscription status
            plan:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                name:
                  type: string
    UnauthorizedError:
      type: object
      description: Unauthorized error response
      properties:
        message:
          type: string
          description: Error message
          example: Invalid api key
      example:
        message: Invalid api key
    NotFoundError:
      type: object
      description: Not found error response
      properties:
        message:
          type: string
          description: Error message
          example: Merchant not found
      example:
        message: Merchant not found
    InternalError:
      type: object
      description: Error response
      properties:
        message:
          type: string
          description: Error message
          example: Error message
      example:
        message: Error message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication (required)
    MerchantIdAuth:
      type: apiKey
      in: header
      name: x-merchant-id
      description: Merchant ID for identifying the merchant (required)

````