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

# Checkout

> Create a Stripe PaymentIntent and a pending Order from the current cart.

Returns a `client_secret` that the frontend passes to `stripe.confirmPayment()`.
For COD / bank transfer, `client_secret` is null and the order goes straight to
`pending` status awaiting manual confirmation.



## OpenAPI

````yaml https://api.vellaro.io/openapi.json post /api/v1/checkout
openapi: 3.1.0
info:
  title: Vellaro API
  description: Vellaro 2026 — E-commerce API
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags: []
paths:
  /api/v1/checkout:
    post:
      tags:
        - orders
        - orders
      summary: Checkout
      description: >-
        Create a Stripe PaymentIntent and a pending Order from the current cart.


        Returns a `client_secret` that the frontend passes to
        `stripe.confirmPayment()`.

        For COD / bank transfer, `client_secret` is null and the order goes
        straight to

        `pending` status awaiting manual confirmation.
      operationId: checkout_api_v1_checkout_post
      parameters:
        - name: cx_cart
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Cx Cart
        - name: cx_ref
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Cx Ref
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_CheckoutResponse_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CheckoutRequest:
      properties:
        shipping_address:
          $ref: '#/components/schemas/AddressSchema'
        billing_address:
          anyOf:
            - $ref: '#/components/schemas/AddressSchema'
            - type: 'null'
        coupon_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Coupon Code
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        locale:
          anyOf:
            - type: string
            - type: 'null'
          title: Locale
        payment_method:
          type: string
          title: Payment Method
          default: stripe
        customer_email:
          anyOf:
            - type: string
              format: email
            - type: 'null'
          title: Customer Email
        subscribe_recurring_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Subscribe Recurring Id
        affiliate_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Affiliate Code
      type: object
      required:
        - shipping_address
      title: CheckoutRequest
      description: Payload sent by the client to initiate checkout.
    ApiResponse_CheckoutResponse_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/CheckoutResponse'
            - type: 'null'
        meta:
          anyOf:
            - $ref: '#/components/schemas/PaginationMeta'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ApiResponse[CheckoutResponse]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AddressSchema:
      properties:
        first_name:
          type: string
          title: First Name
        last_name:
          type: string
          title: Last Name
        company:
          anyOf:
            - type: string
            - type: 'null'
          title: Company
        address_line1:
          type: string
          title: Address Line1
        address_line2:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Line2
        city:
          type: string
          title: City
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        postal_code:
          type: string
          title: Postal Code
        country:
          type: string
          title: Country
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
      type: object
      required:
        - first_name
        - last_name
        - address_line1
        - city
        - postal_code
        - country
      title: AddressSchema
    CheckoutResponse:
      properties:
        order_id:
          type: string
          format: uuid
          title: Order Id
        payment_method:
          type: string
          title: Payment Method
        client_secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Secret
        stripe_publishable_key:
          type: string
          title: Stripe Publishable Key
          default: ''
        paypal_order_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Paypal Order Id
        paypal_client_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Paypal Client Id
        pok_order_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Pok Order Id
        pok_env:
          anyOf:
            - type: string
            - type: 'null'
          title: Pok Env
        paysera_redirect_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Paysera Redirect Url
        bank_details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Bank Details
        subtotal:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Subtotal
        shipping_cost:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Shipping Cost
        tax:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Tax
        tax_rate:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Tax Rate
        prices_include_tax:
          type: boolean
          title: Prices Include Tax
          default: false
        discount_amount:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Discount Amount
        total:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Total
        currency:
          type: string
          title: Currency
      type: object
      required:
        - order_id
        - payment_method
        - subtotal
        - shipping_cost
        - tax
        - discount_amount
        - total
        - currency
      title: CheckoutResponse
      description: Response from POST /checkout — contains everything the frontend needs.
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        total_pages:
          type: integer
          title: Total Pages
      type: object
      required:
        - page
        - page_size
        - total
        - total_pages
      title: PaginationMeta
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````