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

# Create Payment Intent

> Create (or fetch the existing) Stripe PaymentIntent for a checkout.

Auth: same dual shape as `GET /checkout/{id}` —
  * `X-Site-ID` + `X-Stella-Token` (merchant's storefront), or
  * `Authorization: Bearer chk_…` (Stella-hosted checkout-web).

Idempotent: if the checkout already has `payment_intent_id`, the
Stripe API is asked for that same PI and its `client_secret` is
returned to the buyer. Re-charging is up to Stripe's PI lifecycle
(we never create a second PI for the same checkout).

The PaymentIntent's metadata stamps `checkout_id` and
`merchant_id` so the webhook handler can resolve back to the
Stella checkout without trusting client-side state.



## OpenAPI

````yaml /api-reference/openapi.json post /api/storefront/checkout/{checkout_id}/payment-intent
openapi: 3.1.0
info:
  title: Agentic Commerce API
  description: |2-

        Agentic Commerce API - E-commerce Backend

        ## APIs

        ### Dashboard API (`/api/dashboard`)
        Authenticated endpoints for merchant management:
        - Products, Variants, Options
        - Inventory management
        - Orders and fulfillment
        - Customers
        - Collections

        ### Storefront API (`/api/storefront`)
        Public endpoints for client websites:
        - Product catalog
        - Collections
        - Cart management
        - Checkout

        ### Sync API (`/api/sync`)
        Integration endpoints for zunkiree-search:
        - Product sync
        - Availability checks
        - Order creation from AI widget
        
  version: 1.0.0
servers: []
security: []
paths:
  /api/storefront/checkout/{checkout_id}/payment-intent:
    post:
      tags:
        - Storefront
        - Checkout
      summary: Create Payment Intent
      description: |-
        Create (or fetch the existing) Stripe PaymentIntent for a checkout.

        Auth: same dual shape as `GET /checkout/{id}` —
          * `X-Site-ID` + `X-Stella-Token` (merchant's storefront), or
          * `Authorization: Bearer chk_…` (Stella-hosted checkout-web).

        Idempotent: if the checkout already has `payment_intent_id`, the
        Stripe API is asked for that same PI and its `client_secret` is
        returned to the buyer. Re-charging is up to Stripe's PI lifecycle
        (we never create a second PI for the same checkout).

        The PaymentIntent's metadata stamps `checkout_id` and
        `merchant_id` so the webhook handler can resolve back to the
        Stella checkout without trusting client-side state.
      operationId: >-
        create_payment_intent_api_storefront_checkout__checkout_id__payment_intent_post
      parameters:
        - name: checkout_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Checkout Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentIntentResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PaymentIntentResponse:
      properties:
        payment_intent_id:
          type: string
          title: Payment Intent Id
        client_secret:
          type: string
          title: Client Secret
        amount:
          type: integer
          title: Amount
        currency:
          type: string
          title: Currency
        status:
          type: string
          title: Status
      type: object
      required:
        - payment_intent_id
        - client_secret
        - amount
        - currency
        - status
      title: PaymentIntentResponse
      description: |-
        Stripe PaymentIntent client payload.

        Returned from `POST /api/storefront/checkout/{id}/payment-intent`
        so the buyer's browser can mount the Stripe Payment Element with
        `client_secret`. `amount` is in the smallest currency unit (cents
        for USD, paisa for NPR) — same as Stripe's wire format.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````