Skip to main content
June 21, 2026
New featureSDK v0.3.2

Discounts — new feature

Storefronts can now apply automatic discounts and promo codes to a cart before checkout. Automatic discounts apply to every qualifying booking without customer action; code discounts require the customer to enter a promo code.What’s in the release:
  • POST /storefront/cart/discount-code — apply a promo code to the cart
  • DELETE /storefront/cart/discount-code — remove the applied code
  • Every cart-returning endpoint now includes an appliedDiscounts[] field and per-line-item discounts[], so you can render a “you saved $X” summary
  • Order line items carry OrderLineItemDiscount records for accurate receipts and refunds
Key behaviors:
  • Two methods: automatic (applies silently) and code (customer enters a promo code).
  • Two value formats: percentage or fixed amount.
  • Two scopes: line-item (distributed across qualifying lines) and order (applied to the cart total).
  • Targeting by product, staff member, location, and an include add-ons toggle. Discounts re-evaluate on every cart mutation.
  • Scheduling: always-active, weekly-recurring windows, or fixed date ranges — evaluated in the store’s timezone.
  • Requirements: minimum purchase amount and/or appointment duration range.
  • Stacking: combinable discounts stack; exclusive discounts apply the single best deal for the customer.
  • Usage caps: total redemption cap and per-customer cap. Usage is tracked per store on multi-store and Shopify setups.
SDK support — available in @opencals/storefront-sdk v0.3.2 and higher:
import { CartService } from "@opencals/storefront-sdk";

// Apply a promo code
const { data: cart } = await CartService.applyDiscountCode({
  body: { code: "WELCOME10" },
});
// cart.appliedDiscounts now reflects the discount

// Remove it
await CartService.removeDiscountCode();
# Apply a promo code over HTTP
curl -X POST -H "X-Api-Key: sfk_your_key" \
  -H "X-Cart-Id: {cartId}" \
  -H "Content-Type: application/json" \
  -d '{"code": "WELCOME10"}' \
  https://api.opencals.com/storefront/cart/discount-code
See the Discounts feature page for the full overview, and the Build a booking page guide for where promo codes fit in the checkout flow.
Last modified on June 21, 2026