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

# Create a Stripe checkout session

> Create a Stripe-hosted checkout session to purchase AI Gateway credits.



## OpenAPI

````yaml openapi/ai-gateway.yaml POST /credits/checkout-session
openapi: 3.0.3
info:
  title: AI Gateway APIs
  version: 0.1.0
  description: |
    Control-plane HTTP APIs served by the ai-gateway-control service.
servers:
  - url: https://api.ngrok.ai
security:
  - bearerAuth: []
tags:
  - name: AI Gateway Access Key Configurations
    description: Manage reusable access key configurations (scope and routing rules).
  - name: AI Gateway Access Keys
    description: Manage ngrok-managed access keys associated with AI Gateway endpoints.
  - name: AI Gateway Configuration
    description: >-
      Manage per-account AI Gateway configuration (timeouts, token caps,
      metadata).
  - name: AI Gateway API Keys
    description: Manage customer-facing AI Gateway API Keys.
  - name: AI Gateway Firewall Policies
    description: >-
      Manage Firewall policies, the rules that screen the requests and tool
      calls an access key's traffic carries.
  - name: AI Gateway Credits
    description: >-
      Purchase AI Gateway credits, via Stripe Checkout or a charge of the saved
      card, and read purchase/transaction history.
  - name: AI Gateway Providers
    description: Manage AI Gateway providers and the models they expose.
  - name: AI Gateway Custom Providers
    description: Manage custom AI Gateway providers and the models they expose.
  - name: AI Gateway Models
    description: >-
      Read-only listing of AI Gateway models available to the authenticated
      account.
  - name: AI Gateway Provider Keys
    description: >-
      Manage the provider keys your account stores for AI Gateway. Access key
      configurations reference them in routing rule steps.
  - name: AI Gateway Usage
    description: >-
      Read-only AI Gateway usage events and aggregated usage overview for the
      authenticated account.
  - name: AI Gateway Virtual Models
    description: >-
      Manage virtual models, names that stand for an ordered list of models to
      try in turn.
paths:
  /credits/checkout-session:
    post:
      tags:
        - AI Gateway Credits
      summary: Create a Stripe checkout session
      description: Create a Stripe-hosted checkout session to purchase AI Gateway credits.
      operationId: CreateCheckoutSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutSessionCreate'
      responses:
        '200':
          description: The created checkout session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
        default:
          $ref: '#/components/responses/Error'
components:
  schemas:
    CheckoutSessionCreate:
      type: object
      additionalProperties: false
      required:
        - amount
      properties:
        amount:
          type: integer
          format: int64
          minimum: 1
          description: >-
            Amount in cents to purchase. Must be a positive integer. The
            resulting balance cannot exceed the $500 (50000 cent) cap.
    CheckoutSession:
      type: object
      additionalProperties: false
      required:
        - sessionId
        - sessionUrl
      properties:
        sessionId:
          type: string
          description: The Stripe checkout session ID.
        sessionUrl:
          type: string
          format: uri
          description: The hosted Stripe checkout URL to redirect the user to.
    Error:
      type: object
      additionalProperties: false
      required:
        - statusCode
        - msg
        - details
      properties:
        errorCode:
          type: string
          description: Stable ngrok error code when available.
        statusCode:
          type: integer
          format: int32
          description: HTTP status code for this error.
        msg:
          type: string
          description: Human-readable error message.
        details:
          type: object
          description: Structured error details.
          additionalProperties:
            type: string
  responses:
    Error:
      description: API error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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