> ## 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.

# Create a subscription plan

> Creates a new subscription plan for recurring billing. Plans define the pricing, billing interval, and optional trial period for subscriptions.



## OpenAPI

````yaml /api-reference/orchestrator-openapi.json post /v1/plans
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/plans:
    post:
      tags:
        - Subscription Plan
      summary: Create a subscription plan
      description: >-
        Creates a new subscription plan for recurring billing. Plans define the
        pricing, billing interval, and optional trial period for subscriptions.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionPlanRequest'
      responses:
        '201':
          description: Subscription plan created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionPlanResponse'
        '400':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalError'
components:
  schemas:
    CreateSubscriptionPlanRequest:
      type: object
      required:
        - name
        - amount
        - currency
        - interval
      properties:
        externalId:
          type: string
          maxLength: 255
          description: External plan ID from merchant system
          example: PLAN-MONTHLY-001
        name:
          type: string
          minLength: 1
          maxLength: 255
          description: Plan name
          example: Monthly Premium Plan
        description:
          type: string
          maxLength: 1000
          description: Plan description
          example: Premium subscription with all features included
        amount:
          type: integer
          minimum: 1
          description: Amount in smallest currency unit (e.g., cents)
          example: 9900
        currency:
          type: string
          enum:
            - MXN
            - USD
          description: Currency code (ISO 4217)
          example: MXN
        interval:
          type: string
          enum:
            - DAY
            - WEEK
            - MONTH
            - YEAR
          description: Billing interval
          example: MONTH
        intervalCount:
          type: integer
          minimum: 1
          maximum: 12
          default: 1
          description: Number of intervals between billings
          example: 1
        trialDays:
          type: integer
          minimum: 1
          maximum: 365
          description: Number of trial days before first billing
          example: 14
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata for the plan
          example:
            tier: premium
            features:
              - feature1
              - feature2
    SubscriptionPlanResponse:
      type: object
      required:
        - id
        - merchantId
        - name
        - amount
        - currency
        - interval
        - intervalCount
        - active
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique plan identifier
          example: 123e4567-e89b-12d3-a456-426614174000
        merchantId:
          type: string
          description: Merchant identifier
          example: merchant_123
        externalId:
          type: string
          nullable: true
          description: External plan ID from merchant system
          example: PLAN-MONTHLY-001
        name:
          type: string
          description: Plan name
          example: Monthly Premium Plan
        description:
          type: string
          nullable: true
          description: Plan description
          example: Premium subscription with all features included
        amount:
          type: string
          description: Amount in smallest currency unit (string representation of BigInt)
          example: '9900'
        currency:
          type: string
          description: Currency code
          example: MXN
        interval:
          type: string
          enum:
            - DAY
            - WEEK
            - MONTH
            - YEAR
          description: Billing interval
          example: MONTH
        intervalCount:
          type: integer
          description: Number of intervals between billings
          example: 1
        trialDays:
          type: integer
          nullable: true
          description: Number of trial days
          example: 14
        active:
          type: boolean
          description: Whether the plan is active
          example: true
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
          example: '2025-01-15T10:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: '2025-01-15T10:00:00.000Z'
    ValidationError:
      type: object
      description: Validation error response
      required:
        - message
        - errors
      properties:
        message:
          type: string
          description: Error message
          example: Validation failed
        errors:
          type: array
          description: List of validation errors
          items:
            type: object
            properties:
              field:
                type: string
                description: Field that failed validation
                example: name
              message:
                type: string
                description: Validation error message
                example: Required
      example:
        message: Validation failed
        errors:
          - field: name
            message: Required
    UnauthorizedError:
      type: object
      description: Unauthorized error response
      properties:
        message:
          type: string
          description: Error message
          example: Invalid api key
      example:
        message: Invalid api key
    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)

````