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

# Complete checkout for an authenticated user

> Buys one-time Memex usage-balance plans with a Stripe Shared Payment Token. Send an `Idempotency-Key` header for retry-safe payment attempts. Subscription plans should send the user to `https://memex.garden/pricing`.



## OpenAPI

````yaml /api-reference/openapi.json post /checkout
openapi: 3.1.0
info:
  title: Memex REST API
  description: Memex REST API endpoints.
  version: '2026-03-10'
servers:
  - url: https://memex.garden/api
    description: Public edge router
  - url: https://rubctkzqxcdgkbbcprnu.supabase.co/functions/v1
    description: Direct Supabase Edge Functions
security:
  - bearerAuth: []
paths:
  /checkout:
    post:
      summary: Complete checkout for an authenticated user
      description: >-
        Buys one-time Memex usage-balance plans with a Stripe Shared Payment
        Token. Send an `Idempotency-Key` header for retry-safe payment attempts.
        Subscription plans should send the user to
        `https://memex.garden/pricing`.
      operationId: checkout
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgenticCheckoutRequest'
            examples:
              oneTimePlan:
                summary: Buy a one-time usage-balance plan
                value:
                  planId: credit-pack-1000
                  payment:
                    provider: stripe
                    sharedPaymentToken: spt_...
      responses:
        '200':
          description: Checkout response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgenticCheckoutResponse'
        '401':
          description: Authentication required or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '422':
          description: Requested plan cannot be purchased through agentic checkout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnsupportedSubscriptionCheckoutError'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    AgenticCheckoutRequest:
      type: object
      required:
        - payment
      properties:
        planId:
          type: string
          description: Required unless variantId is supplied.
        variantId:
          oneOf:
            - type: string
            - type: number
          description: Required unless planId is supplied.
        payment:
          type: object
          required:
            - provider
            - sharedPaymentToken
          properties:
            provider:
              type: string
              const: stripe
            sharedPaymentToken:
              type: string
              description: Stripe Shared Payment Token issued to Memex.Garden.
          additionalProperties: false
      additionalProperties: false
    AgenticCheckoutResponse:
      type: object
      required:
        - status
        - planId
        - paymentIntentId
      properties:
        status:
          type: string
          enum:
            - succeeded
            - requires_action
            - processing
        planId:
          type: string
        paymentIntentId:
          type: string
        usageBalanceMicrosGranted:
          type: number
          description: Usage balance granted in USD micros. 1,000,000 micros equals $1.00.
      additionalProperties: false
    UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Unauthorized
      additionalProperties: true
    UnsupportedSubscriptionCheckoutError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          const: SUBSCRIPTION_AGENTIC_CHECKOUT_UNSUPPORTED
        message:
          type: string
      additionalProperties: false
    InternalServerError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````

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