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

# Create a checkout

> Creates a Stripe Checkout page for a credit purchase and returns its URL. Requires `billing_write`.

`amount_micros` is $5 to $1,000 in whole cents. Paying saves the card for auto-recharge, and both success and cancel return to the console's billing page. The credit is added once the payment is confirmed, not by this response. Returns `200`, not `201`.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/billing/checkout
openapi: 3.1.0
info:
  title: OpenType API
  version: 0.1.0
  license:
    name: Apache-2.0
  description: >-
    The OpenType HTTP API: decision runs on Neon 1.1, API keys, usage, quota and
    billing. Every `/v1` route takes `Authorization: Bearer <credential>`, where
    the credential is an API key (`otsk_` followed by 64 hex characters) or a
    console session token. Amounts are integers in micro-USD (1,000,000 = 1 US
    dollar). Errors share one envelope, `{"error": {"code", "message",
    "request_id"}}`. Stripe is named only where it hosts checkout, the billing
    portal and receipts.
servers:
  - url: https://api.opentype.dev
    description: Production
  - url: https://api.opentype.dev
    description: Production
security:
  - bearer: []
  - bearer: []
tags:
  - name: runs
    description: Create, list, retrieve and stream runs.
  - name: keys
    description: Create, list, rotate and revoke API keys.
  - name: usage
    description: Usage rollups, the daily series, the ledger and quota.
  - name: billing
    description: Credit balance, checkout, the billing portal and auto-recharge.
  - name: health
    description: Public liveness and readiness checks.
  - name: router
    description: >-
      Model Router: classify a task with Neon 1.1 and pick a model from the
      benchmark catalog.
paths:
  /v1/billing/checkout:
    post:
      tags:
        - billing
      summary: Create a checkout
      description: >-
        Creates a Stripe Checkout page for a credit purchase and returns its
        URL. Requires `billing_write`.


        `amount_micros` is $5 to $1,000 in whole cents. Paying saves the card
        for auto-recharge, and both success and cancel return to the console's
        billing page. The credit is added once the payment is confirmed, not by
        this response. Returns `200`, not `201`.
      operationId: create_checkout
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutRequest'
        required: true
      responses:
        '200':
          description: Where to send the user to pay.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutResponse'
        '400':
          description: >-
            `invalid_amount`: outside 5,000,000 to 1,000,000,000, or not a whole
            number of cents. Malformed JSON gets a plain-text `400`.
        '401':
          description: >-
            `missing_credentials` (no bearer credential) or `invalid_credential`
            (malformed, unknown or revoked).
        '403':
          description: >-
            `scope_denied`: the credential lacks `billing_write`. A session
            without an organization gets `no_active_organization`.
        '413':
          description: The body is over 1 MiB. Plain-text body.
        '503':
          description: >-
            `billing_not_configured`, `stripe_unavailable` (the payment provider
            did not answer), `database_not_configured` or
            `database_unavailable`. Also `auth_not_configured` or
            `trust_keys_unavailable` when credentials cannot be verified.
      security:
        - bearer: []
        - bearer: []
components:
  schemas:
    CheckoutRequest:
      type: object
      required:
        - amount_micros
      properties:
        amount_micros:
          type: integer
          format: int64
          description: >-
            5,000,000 to 1,000,000,000 ($5 to $1,000), a multiple of 10,000
            (whole cents).
          minimum: 0
      additionalProperties: false
    CheckoutResponse:
      type: object
      required:
        - checkout_url
      properties:
        checkout_url:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key (otsk_ + 64 hex) or a console session token.

````