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

# Expire a checkout session

> Expire a checkout session for your organization.

See the [Checkout Sessions guide](/api-reference/checkout-sessions) for purchase inputs, idempotency, and payment status.


## OpenAPI

````yaml api-reference/openapi.json POST /v1/checkout-sessions/{id}/expire
openapi: 3.0.3
info:
  description: >-
    Organization-scoped commerce API for merchant backends: create and manage
    checkout sessions, and query commerce records.
  title: Anyway Merchant API
  contact: {}
  version: '1.0'
  x-source: anyway-backend-go
servers:
  - url: https://merchant-api-prod.anyway.sh
security: []
paths:
  /v1/checkout-sessions/{id}/expire:
    post:
      tags:
        - checkout-sessions
      summary: Expire a checkout session
      parameters:
        - description: Checkout session ID
          name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/response.ApiResponse-merchantapi_CheckoutSessionResponse
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.ApiResponse-any'
      security:
        - APIKeyAuth: []
components:
  schemas:
    response.ApiResponse-merchantapi_CheckoutSessionResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/merchantapi.CheckoutSessionResponse'
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    response.ApiResponse-any:
      type: object
      properties:
        data: {}
        error:
          $ref: '#/components/schemas/response.ErrorDetail'
        message:
          type: string
        success:
          type: boolean
    merchantapi.CheckoutSessionResponse:
      type: object
      properties:
        amount:
          type: integer
        createdAt:
          type: string
        currency:
          type: string
        customerEmail:
          type: string
        customerId:
          type: string
          nullable: true
        expiresAt:
          type: string
          nullable: true
        id:
          type: string
        lastError:
          $ref: '#/components/schemas/checkoutsession.ProviderFailure'
        merchantReference:
          type: string
          nullable: true
        metadata:
          type: object
          additionalProperties:
            type: string
          nullable: true
        orderId:
          type: string
          nullable: true
        orderStatus:
          type: string
        paymentLinkId:
          type: string
          nullable: true
        pricing:
          $ref: '#/components/schemas/checkoutsession.MerchantPricing'
        product:
          $ref: '#/components/schemas/checkoutsession.MerchantProduct'
        productName:
          type: string
        provider:
          type: string
        quantity:
          type: integer
        status:
          $ref: '#/components/schemas/checkoutsession.Status'
        url:
          type: string
          nullable: true
    response.ErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
    checkoutsession.ProviderFailure:
      type: object
      properties:
        code:
          type: string
        occurredAt:
          type: string
        operation:
          type: string
        requestId:
          type: string
    checkoutsession.MerchantPricing:
      type: object
      properties:
        amount:
          description: Amount in the smallest currency unit.
          type: integer
        billingInterval:
          type: string
          enum:
            - DAY
            - MONTH
            - YEAR
            - null
          nullable: true
        billingIntervalCount:
          type: integer
        currency:
          type: string
        flexibleAmount:
          type: boolean
        maxAmount:
          type: integer
          nullable: true
        minAmount:
          type: integer
          nullable: true
        pricingId:
          type: string
          nullable: true
        pricingName:
          type: string
        pricingType:
          $ref: '#/components/schemas/product.PricingType'
    checkoutsession.MerchantProduct:
      type: object
      properties:
        description:
          type: string
        name:
          type: string
        productId:
          type: string
          nullable: true
    checkoutsession.Status:
      type: string
      enum:
        - CREATED
        - COMPLETE
        - EXPIRED
        - FAILED
      x-enum-comments:
        StatusComplete: Checkout is consumed; payment status belongs to Order.
        StatusFailed: >-
          Checkout failed or has no confirmed successful result; operation
          details are stored separately.
      x-enum-descriptions:
        - ''
        - Checkout is consumed; payment status belongs to Order.
        - ''
        - >-
          Checkout failed or has no confirmed successful result; operation
          details are stored separately.
      x-enum-varnames:
        - StatusCreated
        - StatusComplete
        - StatusExpired
        - StatusFailed
    product.PricingType:
      type: string
      enum:
        - SUBSCRIPTION
        - ONE_TIME
      x-enum-varnames:
        - PricingTypeSubscription
        - PricingTypeOneTime
  securitySchemes:
    APIKeyAuth:
      description: 'Merchant API key (format: ak_BASE64)'
      type: apiKey
      name: X-API-Key
      in: header

````

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