> ## 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/storefront.json post /api/v1/checkout
openapi: 3.1.0
info:
  title: Vellaro Storefront API
  description: >-
    The API of storefronts and mobile apps. The store comes from the publishable
    key in the `X-Vellaro-Key` header (or from the store's domain); the
    customer's endpoints also take the customer's token as `Authorization:
    Bearer <access_token>`.
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags:
  - name: Authentication
    description: >-
      Customer sign-up and login, tokens, password reset, email verification,
      Google and Apple login, two-factor authentication.
  - name: Catalog
    description: Products, categories and brands, with filters, sorting and pagination.
  - name: Search
    description: Full-text product search and suggestions as you type.
  - name: Cart
    description: >-
      The cart of a guest (`X-Cart-Token`) or of the logged-in customer, and the
      extra warranty offered on a product page.
  - name: Checkout & orders
    description: >-
      Checkout, the customer's orders and reorder, «Order on WhatsApp» (cart
      codes, clicks).
  - name: Payments
    description: >-
      The store's payment methods, paying an order again, and the confirmation
      steps of PayPal, PokPay and Iute.
  - name: Account
    description: >-
      The logged-in customer: profile, addresses, wishlist, digital downloads,
      subscriptions, affiliate account.
  - name: Reviews & questions
    description: Product reviews and product questions.
  - name: AI chat
    description: 'The store''s AI shopping assistant: conversations, messages, feedback.'
  - name: Content
    description: CMS pages, menus, banners, flipbooks and information pages.
  - name: Marketing & contact
    description: >-
      Newsletter sign-up and email links, the contact form, campaign click
      tracking.
  - name: Store
    description: >-
      The store for the storefront: brand, public settings, languages,
      translations, currencies, physical stores, theme.
  - name: Devices
    description: Push-notification devices of the mobile app.
paths:
  /api/v1/checkout:
    post:
      tags:
        - Checkout & 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: X-Cart-Token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Cart-Token
        - name: cx_ref
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Cx Ref
        - name: cx_cart
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Cx Cart
      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
        business_invoice:
          anyOf:
            - $ref: '#/components/schemas/BusinessInvoiceInput'
            - type: 'null'
        voucher_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Voucher Code
        marketing_consent:
          type: boolean
          title: Marketing Consent
          default: false
        fbp:
          anyOf:
            - type: string
              maxLength: 200
            - type: 'null'
          title: Fbp
        fbc:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Fbc
      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
    BusinessInvoiceInput:
      properties:
        company_name:
          type: string
          title: Company Name
        tax_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tax Id
        vat_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Vat Number
      type: object
      required:
        - company_name
      title: BusinessInvoiceInput
      description: >-
        B2B invoice details captured at checkout for THIS order (order-level

        snapshot). Independent from the account default, so guests and one-off

        company purchases work too. When present the order becomes a B2B
        receipt;

        an Albanian company sends `tax_id` (NIPT), a foreign one `vat_number`
        (VAT).
    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
        iute:
          anyOf:
            - $ref: '#/components/schemas/IuteCheckoutOut'
            - type: 'null'
        bank_details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Bank Details
        subtotal:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Subtotal
        goods_subtotal:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Goods Subtotal
        warranty_total:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Warranty Total
        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
        voucher_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Voucher Code
        voucher_amount:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Voucher Amount
          default: '0'
        voucher_remaining:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Voucher Remaining
        guest_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Guest Token
      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
    IuteCheckoutOut:
      properties:
        mode:
          type: string
          const: redirect
          title: Mode
          default: redirect
        redirect_url:
          type: string
          title: Redirect Url
      type: object
      required:
        - redirect_url
      title: IuteCheckoutOut
      description: >-
        PIANO_IUTE §7.1, DI-16 (IUTE-13): Iute in Redirect. `redirect_url` is
        the

        `checkout.url` of Iute: the storefront sends the customer there with a
        GET,

        and back on `/checkout/iute/return?order_id=…` asks OUR API for the
        state

        (never `?status=`). No `attempt_id` (REV-3): it is the `orderId` sent to

        Iute and does not leave the server.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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