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

# Complete Agentic Checkout Session

> Settle the selected rail and create a native `agentic` order. Settlement failures return 402 and leave the session in `ready_for_payment`.



## OpenAPI

````yaml /openapi.json post /api/v1/checkout-sessions/{sessionId}/complete
openapi: 3.1.0
info:
  title: OmniCommerce API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://omnicommerce.sg/terms
  description: >-
    OmniCommerce API surface for agents and developer integrations. Includes
    public endpoints (merchant discovery, product search, compare, catalog, ACO
    retrieval) and authenticated endpoints (product management via API key
    Bearer tokens).
servers:
  - url: https://omnicommerce.sg
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: agentic-checkout
    description: Merchant-fulfilled agentic checkout
    x-group: Agentic Checkout
  - name: commerce
    description: Root commerce discovery
    x-group: Commerce
  - name: developer-platform
    description: Authenticated developer platform APIs
    x-group: Developer Platform
  - name: looks
    description: AI-styled product looks
    x-group: Looks
  - name: oauth
    description: OAuth token endpoints
    x-group: OAuth
  - name: orders
    description: Workspace and agentic orders
    x-group: Orders
  - name: organizations
    description: Organization management
    x-group: Organizations
  - name: price-books
    description: Marketplace list-price markup rules
    x-group: Price Books
  - name: products
    description: Product CRUD, bulk import, and publish
    x-group: Products
  - name: promotions
    description: Central promotions and marketplace sync
    x-group: Promotions
  - name: public-agent
    description: Public agent discovery and catalog APIs
    x-group: Public Agent
  - name: settlements
    description: settlements
    x-group: Settlements
  - name: ucp
    description: Universal Commerce Protocol
    x-group: UCP
paths:
  /api/v1/checkout-sessions/{sessionId}/complete:
    post:
      tags:
        - agentic-checkout
      summary: Complete Agentic Checkout Session
      description: >-
        Settle the selected rail and create a native `agentic` order. Settlement
        failures return 402 and leave the session in `ready_for_payment`.
      operationId: post_v1_checkout_sessions_by_sessionid_complete
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
        - name: organizationId
          in: query
          required: false
          description: >-
            Optional organization scope for OAuth clients that can access
            multiple organizations.
          schema:
            type: string
            maxLength: 120
        - name: Idempotency-Key
          in: header
          required: false
          description: Optional idempotency key for completion retries.
          schema:
            type: string
            maxLength: 180
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - paymentProof
              properties:
                idempotencyKey:
                  type: string
                  maxLength: 180
                paymentProof:
                  type: object
                  additionalProperties: true
                  description: >-
                    Rail-specific payment proof. ACP uses `{
                    sharedPaymentTokenId: string }`; x402 uses `{
                    paymentPayload: object }` or `{ xPayment: object }`. Local
                    testing may use `{ test: true, testPaymentToken: string }`
                    when test settlement is enabled.
      responses:
        '200':
          description: Checkout completed and native order created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  apiVersion:
                    type: string
                    default: agentic_checkout_v1
                  session:
                    type: object
                    required:
                      - id
                      - organizationId
                      - status
                      - paymentRail
                      - currency
                      - totalAmount
                      - paymentRequirements
                      - expiresAt
                    properties:
                      id:
                        type: string
                      organizationId:
                        type: string
                      status:
                        type: string
                        enum:
                          - ready_for_payment
                          - completed
                          - cancelled
                          - expired
                      paymentRail:
                        type: string
                        enum:
                          - acp_stripe
                          - x402
                      currency:
                        type: string
                      subtotalAmount:
                        type: number
                      shippingAmount:
                        type: number
                      taxAmount:
                        type: number
                      discountAmount:
                        type: number
                      totalAmount:
                        type: number
                      cartVersion:
                        type: integer
                      buyer:
                        type: object
                        additionalProperties: true
                      shippingAddress:
                        type: object
                        additionalProperties: true
                      billingAddress:
                        type: object
                        additionalProperties: true
                      paymentRequirements:
                        type: object
                        additionalProperties: true
                      orderId:
                        type:
                          - string
                          - 'null'
                      expiresAt:
                        type: string
                      completedAt:
                        type:
                          - string
                          - 'null'
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        productId:
                          type: string
                        sku:
                          type:
                            - string
                            - 'null'
                        title:
                          type: string
                        quantity:
                          type: integer
                        unitAmount:
                          type: number
                        currency:
                          type: string
                        imageUrl:
                          type:
                            - string
                            - 'null'
                        productSnapshot:
                          type: object
                          additionalProperties: true
                  settlement:
                    type: object
                    additionalProperties: true
                    properties:
                      ok:
                        type: boolean
                      providerPaymentId:
                        type:
                          - string
                          - 'null'
                      settlementReference:
                        type:
                          - string
                          - 'null'
                      errorCode:
                        type: string
                      errorMessage:
                        type: string
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '402':
          description: Settlement failed; the checkout remains ready for payment.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  apiVersion:
                    type: string
                    default: agentic_checkout_v1
                  session:
                    type: object
                    required:
                      - id
                      - organizationId
                      - status
                      - paymentRail
                      - currency
                      - totalAmount
                      - paymentRequirements
                      - expiresAt
                    properties:
                      id:
                        type: string
                      organizationId:
                        type: string
                      status:
                        type: string
                        enum:
                          - ready_for_payment
                          - completed
                          - cancelled
                          - expired
                      paymentRail:
                        type: string
                        enum:
                          - acp_stripe
                          - x402
                      currency:
                        type: string
                      subtotalAmount:
                        type: number
                      shippingAmount:
                        type: number
                      taxAmount:
                        type: number
                      discountAmount:
                        type: number
                      totalAmount:
                        type: number
                      cartVersion:
                        type: integer
                      buyer:
                        type: object
                        additionalProperties: true
                      shippingAddress:
                        type: object
                        additionalProperties: true
                      billingAddress:
                        type: object
                        additionalProperties: true
                      paymentRequirements:
                        type: object
                        additionalProperties: true
                      orderId:
                        type:
                          - string
                          - 'null'
                      expiresAt:
                        type: string
                      completedAt:
                        type:
                          - string
                          - 'null'
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        productId:
                          type: string
                        sku:
                          type:
                            - string
                            - 'null'
                        title:
                          type: string
                        quantity:
                          type: integer
                        unitAmount:
                          type: number
                        currency:
                          type: string
                        imageUrl:
                          type:
                            - string
                            - 'null'
                        productSnapshot:
                          type: object
                          additionalProperties: true
                  settlement:
                    type: object
                    additionalProperties: true
                    properties:
                      ok:
                        type: boolean
                      providerPaymentId:
                        type:
                          - string
                          - 'null'
                      settlementReference:
                        type:
                          - string
                          - 'null'
                      errorCode:
                        type: string
                      errorMessage:
                        type: string
        '403':
          description: Forbidden or checkout not enabled
        '404':
          description: Checkout session not found
        '409':
          description: Terminal or expired checkout session
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer API key for server-to-server access. Session auth is also
        supported in first-party UI flows.

````