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

# Storefront

> Storefront cart and checkout events. Full list of cart and checkout events and their payload schemas.

Storefront events fire when a shopper interacts with the cart or checkout.

Storefront events trigger **sync automations**. This means they run on a user's critical path and must be fast and deterministic. Because of this, they have some contraints:

* they can't use any of the Agent steps
* they can't use `delay`, `wait_for_event`, `parallel`, `map` steps
* they have execution timeout of **10 seconds**
* only **one automation** can be active for each event

Shopper PII in storefront event payloads is privacy-safe. Fields like `customer_email` can be null, and address details may be omitted when they are not needed for the event.

## Cart

<AccordionGroup>
  <Accordion title="CART_CREATED">
    New shopping cart initialized.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="cart_uid" type="string">
          Unique cart identifier
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CART_ITEM_ADDED">
    Item added to a cart.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="cart_uid" type="string">
          Unique cart identifier
        </ParamField>

        <ParamField path="item" type="CartItemData">
          Added item details
        </ParamField>

        <ParamField path="cart_item_count" type="integer">
          Total items in cart
        </ParamField>

        <ParamField path="cart_subtotal" type="number">
          Cart subtotal
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CART_ITEM_UPDATED">
    Cart item quantity changed.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="cart_uid" type="string">
          Unique cart identifier
        </ParamField>

        <ParamField path="item" type="CartItemData">
          Updated item details
        </ParamField>

        <ParamField path="previous_quantity" type="integer">
          Previous quantity
        </ParamField>

        <ParamField path="cart_item_count" type="integer">
          Total items in cart
        </ParamField>

        <ParamField path="cart_subtotal" type="number">
          Cart subtotal
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CART_ITEM_REMOVED">
    Item removed from a cart.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="cart_uid" type="string">
          Unique cart identifier
        </ParamField>

        <ParamField path="removed_item" type="CartItemData">
          Removed item details
        </ParamField>

        <ParamField path="cart_item_count" type="integer">
          Total items in cart
        </ParamField>

        <ParamField path="cart_subtotal" type="number">
          Cart subtotal
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>
</AccordionGroup>

## Checkout

<AccordionGroup>
  <Accordion title="CHECKOUT_STARTED">
    Checkout session initiated.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="cart_uid" type="string?">
          Cart identifier (if from cart)
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="total_amount" type="number">
          Checkout total
        </ParamField>

        <ParamField path="item_count" type="integer">
          Number of items
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CHECKOUT_ADDRESS_SET">
    Billing address provided during checkout.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="total_amount" type="number">
          Checkout total
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email
        </ParamField>

        <ParamField path="billing_address" type="Address?">
          Billing address, when available
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CHECKOUT_PAYMENT_SELECTED">
    Payment provider selected during checkout.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="total_amount" type="number">
          Checkout total
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email
        </ParamField>

        <ParamField path="payment_provider" type="string">
          Selected payment provider
        </ParamField>

        <ParamField path="previous_provider" type="string?">
          Previously selected provider
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CHECKOUT_COMPLETED">
    Checkout completed successfully.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="total_amount" type="number">
          Checkout total
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email
        </ParamField>

        <ParamField path="payment_provider" type="string?">
          Payment provider used
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CHECKOUT_PAYMENT_FAILED">
    Payment failed during checkout.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="total_amount" type="number">
          Checkout total
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email
        </ParamField>

        <ParamField path="payment_provider" type="string?">
          Payment provider used
        </ParamField>

        <ParamField path="error_code" type="string?">
          Error code
        </ParamField>

        <ParamField path="error_message" type="string?">
          Error message
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>

  <Accordion title="CHECKOUT_VALIDATE_DISCOUNT_CODE">
    Customer submitted a discount code at checkout. **Synchronous return** event — automation must produce a `DiscountValidationResult`.

    <ParamField path="payload" type="object">
      <Expandable title="properties">
        <ParamField path="checkout_uid" type="string">
          Unique checkout session identifier
        </ParamField>

        <ParamField path="order_uid" type="string?">
          Order identifier
        </ParamField>

        <ParamField path="discount_code" type="string">
          The code the customer entered
        </ParamField>

        <ParamField path="subtotal_amount" type="number">
          Order subtotal in dollars (used to compute percentage discounts)
        </ParamField>

        <ParamField path="currency" type="string">
          Currency code
        </ParamField>

        <ParamField path="customer_email" type="string?">
          Customer email (for per-customer limits)
        </ParamField>
      </Expandable>
    </ParamField>

    Required automation output:

    <ParamField path="DiscountValidationResult" type="object">
      <Expandable title="properties">
        <ParamField path="valid" type="boolean">
          Whether the code is accepted
        </ParamField>

        <ParamField path="code" type="string">
          Echo of the submitted code
        </ParamField>

        <ParamField path="discount_type" type="&#x22;fixed_amount&#x22; | &#x22;percentage&#x22;">
          How the discount is calculated
        </ParamField>

        <ParamField path="amount_minor" type="integer?">
          Discount in cents (required when `discount_type=fixed_amount`)
        </ParamField>

        <ParamField path="percentage_off" type="integer?">
          Whole-number percent off (required when `discount_type=percentage`, 0-100)
        </ParamField>

        <ParamField path="label" type="string?">
          Human-readable label shown at checkout
        </ParamField>

        <ParamField path="max_uses" type="integer?">
          Cap on total redemptions (null = unlimited)
        </ParamField>
      </Expandable>
    </ParamField>
  </Accordion>
</AccordionGroup>

## Shared Types

<ParamField path="CartItemData" type="object">
  <Expandable title="properties">
    <ParamField path="product_uid" type="string">
      Product identifier
    </ParamField>

    <ParamField path="product_name" type="string">
      Product name
    </ParamField>

    <ParamField path="quantity" type="integer">
      Quantity in cart
    </ParamField>

    <ParamField path="unit_price" type="number">
      Price per unit
    </ParamField>

    <ParamField path="line_total" type="number">
      Total for this line
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="Address" type="object">
  <Expandable title="properties">
    <ParamField path="line1" type="string">
      Street address
    </ParamField>

    <ParamField path="line2" type="string?">
      Apartment, suite, etc.
    </ParamField>

    <ParamField path="city" type="string">
      City
    </ParamField>

    <ParamField path="state" type="string?">
      State or province
    </ParamField>

    <ParamField path="postal_code" type="string">
      Postal/ZIP code
    </ParamField>

    <ParamField path="country" type="string">
      Country code
    </ParamField>
  </Expandable>
</ParamField>
