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

# Create a checkout session



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json post /api/v1/checkout-sessions
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Proprietary
    identifier: LicenseRef-Proprietary
  version: 0.1.0
servers: []
security: []
tags:
  - name: Meteroid
    description: Meteroid API
  - name: Add-ons
  - name: Batch Jobs
  - name: Checkout Sessions
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - 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
paths:
  /api/v1/checkout-sessions:
    post:
      tags:
        - Checkout Sessions
      summary: Create a checkout session
      operationId: create_checkout_session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCheckoutSessionRequest'
        required: true
      responses:
        '200':
          description: Checkout session created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCheckoutSessionResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    CreateCheckoutSessionRequest:
      type: object
      required:
        - customer_id
        - plan_version_id
      properties:
        add_ons:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/CreateSubscriptionAddOn'
        auto_advance_invoices:
          type:
            - boolean
            - 'null'
          description: >-
            If false, invoices will stay in Draft until manually reviewed and
            finalized. Default is true.
        billing_day_anchor:
          type:
            - integer
            - 'null'
          format: int32
        billing_start_date:
          type:
            - string
            - 'null'
          format: date
        charge_automatically:
          type:
            - boolean
            - 'null'
          description: >-
            Automatically try to charge the customer's configured payment method
            on finalize. Default is true.
        components:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CreateSubscriptionComponents'
        coupon_code:
          type:
            - string
            - 'null'
        coupon_ids:
          type: array
          items:
            $ref: '#/components/schemas/CouponId'
        customer_id:
          type: string
          format: CustomerId or customer alias
          description: Customer ID or alias
        end_date:
          type:
            - string
            - 'null'
          format: date
        expires_in_hours:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Session expiry time in hours. Default is 1 hour for self-serve
            checkout.
          minimum: 0
        invoice_memo:
          type:
            - string
            - 'null'
        invoice_threshold:
          type:
            - string
            - 'null'
          format: decimal
        metadata: {}
        net_terms:
          type:
            - integer
            - 'null'
          format: int32
        payment_methods_config:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PaymentMethodsConfig'
              description: >-
                Payment methods configuration. If not specified, inherits from
                the invoicing entity.
        plan_version_id:
          $ref: '#/components/schemas/PlanVersionId'
        purchase_order:
          type:
            - string
            - 'null'
        trial_duration_days:
          type:
            - integer
            - 'null'
          format: int32
    CreateCheckoutSessionResponse:
      type: object
      required:
        - session
      properties:
        session:
          $ref: '#/components/schemas/CheckoutSession'
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    CreateSubscriptionAddOn:
      type: object
      required:
        - add_on_id
      properties:
        add_on_id:
          $ref: '#/components/schemas/AddOnId'
        customization:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SubscriptionAddOnCustomization'
        quantity:
          type: integer
          format: int32
          minimum: 0
    CreateSubscriptionComponents:
      type: object
      properties:
        extra_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ExtraComponent'
        overridden_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ComponentOverride'
        parameterized_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ComponentParameterization'
        remove_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/PriceComponentId'
    CouponId:
      type: string
      format: MeteroidId
      examples:
        - cou_7n42DGM5Tflk9n8mt7Fhc7
    PaymentMethodsConfig:
      oneOf:
        - $ref: '#/components/schemas/OnlinePaymentMethodConfig'
        - $ref: '#/components/schemas/BankTransferPaymentMethodConfig'
        - $ref: '#/components/schemas/ExternalPaymentMethodConfig'
      description: Online (card/direct debit), BankTransfer, or External.
      discriminator:
        propertyName: type
        mapping:
          bank_transfer:
            $ref: '#/components/schemas/BankTransferPaymentMethodConfig'
          external:
            $ref: '#/components/schemas/ExternalPaymentMethodConfig'
          online:
            $ref: '#/components/schemas/OnlinePaymentMethodConfig'
    PlanVersionId:
      type: string
      format: MeteroidId
      examples:
        - plv_7n42DGM5Tflk9n8mt7Fhc7
    CheckoutSession:
      type: object
      required:
        - id
        - customer_id
        - plan_version_id
        - status
        - checkout_type
        - created_at
      properties:
        billing_day_anchor:
          type:
            - integer
            - 'null'
          format: int32
        billing_start_date:
          type:
            - string
            - 'null'
          format: date
        checkout_type:
          $ref: '#/components/schemas/CheckoutType'
        checkout_url:
          type:
            - string
            - 'null'
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        coupon_code:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        customer_id:
          $ref: '#/components/schemas/CustomerId'
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the session expires. None means the session never expires.
        id:
          $ref: '#/components/schemas/CheckoutSessionId'
        net_terms:
          type:
            - integer
            - 'null'
          format: int32
        payment_methods_config:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PaymentMethodsConfig'
        plan_version_id:
          $ref: '#/components/schemas/PlanVersionId'
        status:
          $ref: '#/components/schemas/CheckoutSessionStatus'
        subscription_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SubscriptionId'
        trial_duration_days:
          type:
            - integer
            - 'null'
          format: int32
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
    AddOnId:
      type: string
      format: MeteroidId
      examples:
        - add_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionAddOnCustomization:
      oneOf:
        - $ref: '#/components/schemas/SubscriptionAddOnPriceOverride'
        - $ref: '#/components/schemas/SubscriptionAddOnParameterization'
      discriminator:
        propertyName: type
        mapping:
          PARAMETERIZATION:
            $ref: '#/components/schemas/SubscriptionAddOnParameterization'
          PRICE_OVERRIDE:
            $ref: '#/components/schemas/SubscriptionAddOnPriceOverride'
    ExtraComponent:
      type: object
      required:
        - name
        - product_ref
        - price_entry
      properties:
        name:
          type: string
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
        product_ref:
          $ref: '#/components/schemas/ProductRef'
    ComponentOverride:
      type: object
      required:
        - component_id
        - name
        - price_entry
      properties:
        component_id:
          $ref: '#/components/schemas/PriceComponentId'
        name:
          type: string
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
    ComponentParameterization:
      type: object
      required:
        - component_id
        - parameters
      properties:
        component_id:
          $ref: '#/components/schemas/PriceComponentId'
        parameters:
          $ref: '#/components/schemas/ComponentParameters'
    PriceComponentId:
      type: string
      format: MeteroidId
      examples:
        - price_7n42DGM5Tflk9n8mt7Fhc7
    OnlinePaymentMethodConfig:
      type: object
      properties:
        config:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodsConfig'
              description: If None, inherits all online providers from invoicing entity.
    BankTransferPaymentMethodConfig:
      type: object
      properties:
        account_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BankAccountId'
    ExternalPaymentMethodConfig:
      type: object
    CheckoutType:
      type: string
      enum:
        - SELF_SERVE
        - SUBSCRIPTION_ACTIVATION
        - PLAN_CHANGE
        - ADDON_PURCHASE
    CustomerId:
      type: string
      format: MeteroidId
      examples:
        - cus_7n42DGM5Tflk9n8mt7Fhc7
    CheckoutSessionId:
      type: string
      format: MeteroidId
      examples:
        - che_7n42DGM5Tflk9n8mt7Fhc7
    CheckoutSessionStatus:
      type: string
      title: CheckoutSessionStatus
      enum:
        - CREATED
        - AWAITING_PAYMENT
        - COMPLETED
        - EXPIRED
        - CANCELLED
    SubscriptionId:
      type: string
      format: MeteroidId
      examples:
        - sub_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionAddOnPriceOverride:
      type: object
      required:
        - price_entry
      properties:
        name:
          type:
            - string
            - 'null'
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
    SubscriptionAddOnParameterization:
      type: object
      properties:
        billing_period:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BillingPeriodEnum'
        committed_capacity:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        initial_slot_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
    PriceEntry:
      oneOf:
        - $ref: '#/components/schemas/ExistingPriceRef'
        - $ref: '#/components/schemas/PriceInput'
      discriminator:
        propertyName: type
        mapping:
          EXISTING:
            $ref: '#/components/schemas/ExistingPriceRef'
          NEW:
            $ref: '#/components/schemas/PriceInput'
    ProductRef:
      oneOf:
        - $ref: '#/components/schemas/ExistingProductRef'
        - $ref: '#/components/schemas/NewProductRef'
      discriminator:
        propertyName: type
        mapping:
          EXISTING:
            $ref: '#/components/schemas/ExistingProductRef'
          NEW:
            $ref: '#/components/schemas/NewProductRef'
    ComponentParameters:
      type: object
      properties:
        billing_period:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BillingPeriodEnum'
        committed_capacity:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        initial_slot_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
    OnlineMethodsConfig:
      type: object
      properties:
        card:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodConfig'
        direct_debit:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodConfig'
    BankAccountId:
      type: string
      format: MeteroidId
      examples:
        - ba_7n42DGM5Tflk9n8mt7Fhc7
    BillingPeriodEnum:
      type: string
      enum:
        - MONTHLY
        - QUARTERLY
        - SEMIANNUAL
        - ANNUAL
    ExistingPriceRef:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/PriceId'
    PriceInput:
      type: object
      required:
        - cadence
        - currency
        - pricing
      properties:
        cadence:
          $ref: '#/components/schemas/BillingPeriodEnum'
        currency:
          type: string
        pricing:
          $ref: '#/components/schemas/Pricing'
    ExistingProductRef:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/ProductId'
    NewProductRef:
      type: object
      required:
        - name
        - fee_type
        - fee_structure
      properties:
        fee_structure:
          $ref: '#/components/schemas/ProductFeeStructure'
        fee_type:
          $ref: '#/components/schemas/ProductFeeTypeEnum'
        name:
          type: string
    OnlineMethodConfig:
      type: object
      required:
        - enabled
      properties:
        enabled:
          type: boolean
    PriceId:
      type: string
      format: MeteroidId
      examples:
        - pri_7n42DGM5Tflk9n8mt7Fhc7
    Pricing:
      oneOf:
        - $ref: '#/components/schemas/RatePricing'
        - $ref: '#/components/schemas/SlotPricing'
        - $ref: '#/components/schemas/CapacityPricing'
        - $ref: '#/components/schemas/UsagePricing'
        - $ref: '#/components/schemas/ExtraRecurringPricing'
        - $ref: '#/components/schemas/OneTimePricing'
      discriminator:
        propertyName: type
        mapping:
          CAPACITY:
            $ref: '#/components/schemas/CapacityPricing'
          EXTRA_RECURRING:
            $ref: '#/components/schemas/ExtraRecurringPricing'
          ONE_TIME:
            $ref: '#/components/schemas/OneTimePricing'
          RATE:
            $ref: '#/components/schemas/RatePricing'
          SLOT:
            $ref: '#/components/schemas/SlotPricing'
          USAGE:
            $ref: '#/components/schemas/UsagePricing'
    ProductId:
      type: string
      format: MeteroidId
      examples:
        - prd_7n42DGM5Tflk9n8mt7Fhc7
    ProductFeeStructure:
      oneOf:
        - $ref: '#/components/schemas/RateFeeStructure'
        - $ref: '#/components/schemas/SlotFeeStructure'
        - $ref: '#/components/schemas/CapacityFeeStructure'
        - $ref: '#/components/schemas/UsageFeeStructure'
        - $ref: '#/components/schemas/ExtraRecurringFeeStructure'
        - $ref: '#/components/schemas/OneTimeFeeStructure'
      discriminator:
        propertyName: type
        mapping:
          CAPACITY:
            $ref: '#/components/schemas/CapacityFeeStructure'
          EXTRA_RECURRING:
            $ref: '#/components/schemas/ExtraRecurringFeeStructure'
          ONE_TIME:
            $ref: '#/components/schemas/OneTimeFeeStructure'
          RATE:
            $ref: '#/components/schemas/RateFeeStructure'
          SLOT:
            $ref: '#/components/schemas/SlotFeeStructure'
          USAGE:
            $ref: '#/components/schemas/UsageFeeStructure'
    ProductFeeTypeEnum:
      type: string
      enum:
        - RATE
        - SLOT
        - CAPACITY
        - USAGE
        - EXTRA_RECURRING
        - ONE_TIME
    RatePricing:
      type: object
      required:
        - rate
      properties:
        rate:
          type: string
          format: decimal
    SlotPricing:
      type: object
      required:
        - unit_rate
      properties:
        max_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        min_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        unit_rate:
          type: string
          format: decimal
    CapacityPricing:
      type: object
      required:
        - rate
        - included
        - overage_rate
      properties:
        included:
          type: integer
          format: int64
          minimum: 0
        overage_rate:
          type: string
          format: decimal
        rate:
          type: string
          format: decimal
    UsagePricing:
      type: object
      required:
        - model
      properties:
        model:
          $ref: '#/components/schemas/UsagePricingModel'
    ExtraRecurringPricing:
      type: object
      required:
        - unit_price
        - quantity
      properties:
        quantity:
          type: integer
          format: int32
          minimum: 0
        unit_price:
          type: string
          format: decimal
    OneTimePricing:
      type: object
      required:
        - unit_price
        - quantity
      properties:
        quantity:
          type: integer
          format: int32
          minimum: 0
        unit_price:
          type: string
          format: decimal
    RateFeeStructure:
      type: object
    SlotFeeStructure:
      type: object
      required:
        - slot_unit_name
        - upgrade_policy
        - downgrade_policy
      properties:
        downgrade_policy:
          $ref: '#/components/schemas/SlotDowngradePolicyEnum'
        slot_unit_name:
          type: string
        upgrade_policy:
          $ref: '#/components/schemas/SlotUpgradePolicyEnum'
    CapacityFeeStructure:
      type: object
      required:
        - metric_id
      properties:
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
    UsageFeeStructure:
      type: object
      required:
        - metric_id
        - model
      properties:
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
        model:
          $ref: '#/components/schemas/UsageModelEnum'
    ExtraRecurringFeeStructure:
      type: object
      required:
        - billing_type
      properties:
        billing_type:
          $ref: '#/components/schemas/ExtraRecurringBillingTypeEnum'
    OneTimeFeeStructure:
      type: object
    UsagePricingModel:
      oneOf:
        - $ref: '#/components/schemas/PerUnitPricing'
        - $ref: '#/components/schemas/TieredPricing'
        - $ref: '#/components/schemas/VolumePricing'
        - $ref: '#/components/schemas/PackagePricing'
        - $ref: '#/components/schemas/MatrixPricing'
      discriminator:
        propertyName: type
        mapping:
          MATRIX:
            $ref: '#/components/schemas/MatrixPricing'
          PACKAGE:
            $ref: '#/components/schemas/PackagePricing'
          PER_UNIT:
            $ref: '#/components/schemas/PerUnitPricing'
          TIERED:
            $ref: '#/components/schemas/TieredPricing'
          VOLUME:
            $ref: '#/components/schemas/VolumePricing'
    SlotDowngradePolicyEnum:
      type: string
      enum:
        - REMOVE_AT_END_OF_PERIOD
    SlotUpgradePolicyEnum:
      type: string
      enum:
        - PRORATED
    BillableMetricId:
      type: string
      format: MeteroidId
      examples:
        - bm_7n42DGM5Tflk9n8mt7Fhc7
    UsageModelEnum:
      type: string
      enum:
        - PER_UNIT
        - TIERED
        - VOLUME
        - PACKAGE
        - MATRIX
    ExtraRecurringBillingTypeEnum:
      type: string
      enum:
        - ADVANCE
        - ARREARS
    PerUnitPricing:
      type: object
      required:
        - rate
      properties:
        rate:
          type: string
          format: decimal
    TieredPricing:
      type: object
      required:
        - tiers
      properties:
        block_size:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/TierRow'
    VolumePricing:
      type: object
      required:
        - tiers
      properties:
        block_size:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/TierRow'
    PackagePricing:
      type: object
      required:
        - block_size
        - rate
      properties:
        block_size:
          type: integer
          format: int64
          minimum: 0
        rate:
          type: string
          format: decimal
    MatrixPricing:
      type: object
      required:
        - rates
      properties:
        rates:
          type: array
          items:
            $ref: '#/components/schemas/MatrixRow'
    TierRow:
      type: object
      required:
        - first_unit
        - rate
        - flat_fee
        - flat_cap
      properties:
        first_unit:
          type: integer
          format: int64
          minimum: 0
        flat_cap:
          type: string
          format: decimal
        flat_fee:
          type: string
          format: decimal
        rate:
          type: string
          format: decimal
    MatrixRow:
      type: object
      required:
        - dimension1
        - per_unit_price
      properties:
        dimension1:
          $ref: '#/components/schemas/MatrixDimension'
        dimension2:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/MatrixDimension'
        per_unit_price:
          type: string
          format: decimal
    MatrixDimension:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````