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

# Create a checkout session

> Creates a hosted checkout session. Call this from your server with a secret key. The network (mainnet or testnet) is determined by the key: `sk_live_` keys create mainnet sessions, `sk_test_` keys create testnet sessions. Sessions expire 30 minutes after creation.



## OpenAPI

````yaml /openapi.json post /v1/checkout/sessions
openapi: 3.0.3
info:
  title: Warp API
  version: 1.0.0
  description: >-
    Public Warp API: hosted checkout sessions for Pay with Warp, hosted ZK proof
    verification, and Warp Verify attestation checks.
  contact:
    name: Warp Support
    email: support@usewarp.net
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.usewarp.net
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Checkout sessions
    description: Create and track hosted checkout sessions.
  - name: ZK verification
    description: Verify Groth16 proofs against circuits deployed from the Warp Platform.
  - name: Attestations
    description: Public Warp Verify attestation checks.
  - name: Health
    description: Service status.
paths:
  /v1/checkout/sessions:
    post:
      tags:
        - Checkout sessions
      summary: Create a checkout session
      description: >-
        Creates a hosted checkout session. Call this from your server with a
        secret key. The network (mainnet or testnet) is determined by the key:
        `sk_live_` keys create mainnet sessions, `sk_test_` keys create testnet
        sessions. Sessions expire 30 minutes after creation.
      operationId: createCheckoutSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutSessionCreateRequest'
            example:
              amount_usd: 49.99
              description: 'Order #1234'
              metadata:
                order_id: '1234'
              return_url: https://example.com/orders/1234
              cancel_url: https://example.com/cart
      responses:
        '201':
          description: Session created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: invalid_request
                  message: 'amount_usd: Number must be greater than 0'
        '401':
          description: Missing or invalid secret key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: unauthorized
                  message: Invalid API key
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: rate_limited
                  message: Too many requests. Retry after the window resets.
components:
  schemas:
    CheckoutSessionCreateRequest:
      type: object
      required:
        - amount_usd
      properties:
        amount_usd:
          type: number
          minimum: 0.01
          multipleOf: 0.01
          description: Amount to charge in USD. Greater than 0, at most 2 decimal places.
          example: 49.99
        description:
          type: string
          description: Shown to the customer on the checkout page.
        metadata:
          type: object
          additionalProperties: true
          description: >-
            Your own key-value data, returned on the session and in webhooks.
            Keys starting with `_warp_` are reserved and rejected.
        return_url:
          type: string
          format: uri
          description: >-
            Where the "Back to merchant" button on the payment success page
            sends the customer.
        cancel_url:
          type: string
          format: uri
          description: >-
            Where the "Cancel and return" link on the checkout page sends the
            customer.
    CheckoutSession:
      type: object
      properties:
        id:
          type: string
          example: ps_8f14e45fceea167a5a36dedd4bea2543
        object:
          type: string
          enum:
            - checkout.session
        amount_usd:
          type: string
          description: Amount in USD as a decimal string.
          example: '49.99'
        currency:
          type: string
          enum:
            - USD
        description:
          type: string
          nullable: true
        metadata:
          type: object
          nullable: true
          additionalProperties: true
        status:
          $ref: '#/components/schemas/CheckoutSessionStatus'
        network:
          type: string
          enum:
            - mainnet
            - testnet
          description: Determined by the secret key used to create the session.
        return_url:
          type: string
          nullable: true
        cancel_url:
          type: string
          nullable: true
        expires_at:
          type: string
          format: date-time
          description: 30 minutes after creation.
        created_at:
          type: string
          format: date-time
        checkout_url:
          type: string
          format: uri
          description: Hosted checkout page to redirect the customer to.
          example: >-
            https://checkout.usewarp.net/session/ps_8f14e45fceea167a5a36dedd4bea2543
        payment:
          type: object
          allOf:
            - $ref: '#/components/schemas/Payment'
          nullable: true
          description: Present on retrieve once a payment has been detected.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code: `invalid_request`, `unauthorized`,
                `not_found`, `proof_not_ready`, `onchain_unavailable`,
                `rate_limited` or `internal_error`.
              example: invalid_request
            message:
              type: string
              description: Human-readable description.
    CheckoutSessionStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - expired
      description: >-
        `pending`: waiting for payment. `processing`: a transaction was
        submitted and is being verified. `completed`: payment verified.
        `failed`: verification failed. `expired`: no payment within 30 minutes.
    Payment:
      type: object
      description: The on-chain payment for a session.
      properties:
        chain:
          type: string
          description: Network the customer paid on.
          example: base
        token:
          type: string
          description: >-
            Token the customer paid with. You receive this token; there is no
            conversion.
          example: USDC
        tx_hash:
          type: string
          description: Transaction hash (lowercase).
          example: 0x5f2c...
        amount:
          type: string
          description: Token amount paid, as a decimal string.
          example: '49.99'
        confirmations:
          type: integer
          description: Block confirmations observed.
        completed_at:
          type: string
          format: date-time
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your project secret key: `sk_test_...` (testnet) or `sk_live_...`
        (mainnet). Use it only on your server.

````

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