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

# Checkout

> Create a Stripe checkout session for a customer using a Stripe product key, with an optional Stripe price ID override.



## OpenAPI

````yaml POST /v1/customers/{customerId}/checkout
openapi: 3.1.0
info:
  title: PriceOS Public API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/customers/{customerId}/checkout:
    post:
      summary: Create checkout session
      description: >-
        Create a Stripe checkout session for a customer using a Stripe product
        key, with an optional Stripe price ID override.
      parameters:
        - schema:
            type: string
            description: Internal customer ID.
          required: true
          description: Internal customer ID.
          name: customerId
          in: path
        - schema:
            type: string
            description: API key from your PriceOS dashboard.
          required: true
          description: API key from your PriceOS dashboard.
          name: x-api-key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                productKey:
                  type: string
                  description: >-
                    Product key from your PriceOS dashboard. Must reference a
                    Stripe product (not a custom product).
                stripePriceId:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Optional Stripe price ID. When provided, it must be active
                    and belong to the selected Stripe product.
                successUrl:
                  type: string
                  format: uri
                  description: Optional checkout success redirect URL.
                cancelUrl:
                  type: string
                  format: uri
                  description: Optional checkout cancel redirect URL.
                metadata:
                  type: object
                  additionalProperties:
                    type: string
                  description: Optional metadata to attach to the Stripe checkout session.
                customerInfo:
                  type: object
                  properties:
                    name:
                      type:
                        - string
                        - 'null'
                      description: Optional customer name.
                    email:
                      type:
                        - string
                        - 'null'
                      description: Optional customer email address.
                  additionalProperties: false
                  description: >-
                    Optional customer info used when creating/updating the
                    customer.
                checkoutParams:
                  type: object
                  additionalProperties: {}
                  description: >-
                    Optional Stripe Checkout Session params to merge into the
                    request.
              required:
                - productKey
      responses:
        '200':
          description: Checkout session
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
                    description: Stripe checkout URL.
                required:
                  - url
              example:
                url: https://checkout.stripe.com/c/pay/cs_test_123
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
      x-codeSamples:
        - lang: typescript
          label: Node.js
          source: >-
            import { PriceOS } from "priceos";

            import type { MyFeatures } from "./priceos.types";


            const priceos = new
            PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);


            const session = await
            priceos.customers.createCheckout("customer_123", {
              productKey: "starter_monthly",
              successUrl: "https://app.acme.com/billing/success",
              customerInfo: {
                name: "Alex Johnson",
                email: "alex@acme.com",
              },
            });
        - lang: bash
          label: cURL
          source: >-
            curl -X POST
            "https://api.priceos.com/v1/customers/customer_123/checkout" \
              -H "x-api-key: PRICEOS_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "productKey": "starter_monthly",
                "successUrl": "https://app.acme.com/billing/success",
                "customerInfo": {
                  "name": "Alex Johnson",
                  "email": "alex@acme.com"
                }
              }'

````