Skip to content
Reponse.ai LogoDocs
DocsAPISDKsGuides

Search Documentation

Search for an article...

Getting Started

  • Overview
  • Architecture
  • Installation
  • Authentication
  • First Request

Products & Collections

  • Products — List
  • Products — Get
  • Products — Metafields
  • Collections — List
  • Collections — Get
  • Collections — Products

Cart & Checkout

  • Cart — Create
  • Cart — Get
  • Cart — Add Item
  • Cart — Update Item
  • Cart — Remove Item
  • Cart — Apply Promotion
  • Checkout — Stripe
  • Checkout — Payment Intent
  • Checkout — ACP

Orders & Fulfillment

  • Orders — Create
  • Orders — Get
  • Orders — Confirm
  • Orders — Cancel
  • Orders — Fulfill
  • Orders — Refund

Commerce

  • Inventory — Get
  • Inventory — Update
  • Shipping — Rates
  • Discounts — List
  • Discounts — Create
  • Discounts — Validate
  • Subscriptions — Manage

Loyalty & Gift Cards

  • Loyalty — Balance
  • Loyalty — Redeem
  • Loyalty — Referral
  • Gift Cards — List
  • Gift Cards — Redeem

Tickets & Support

  • Tickets — List
  • Tickets — Create
  • Tickets — Reply

Platform

  • Product Feed — JSON
  • Product Feed — CSV
  • Theme — Get
  • Approvals — Execute
  • Approvals — Reject
  • Geocode

SDKs

  • SDK Overview
  • TypeScript SDK
  • React Hooks

Guides

  • Chat Widget
  • Shopify Sync
  • Storefront Starter
  • Loyalty Program
  • Discounts & Promotions
  • Subscriptions
  • Klaviyo Integration
  • Custom Domains
  • Agentic Commerce (ACP)
  • A2A Protocol
  • AI Engines
  • MCP Server

Webhooks

  • Webhooks Overview
  • Events Reference
  • Shopify Webhooks
  • Stripe Webhooks
  • Reviews (Stamped / Trustpilot)
  • Logistics
  • Email Inbound

Resources

  • Environment Variables
  • Rate Limits
  • Changelog
DocsGuidesDiscounts & Promotions

Discounts & Promotions

Discounts and promotions: codes, automatic discounts, and the promotions engine.

3 min read/Last updated Aug 19, 2026
On this page

Overview

Reponse supports discount codes, automatic discounts, and a promotions engine. Codes can be shopper-entered or auto-applied. When a code is applied to a cart, Reponse checks the promotions table first, then falls back to legacy discount codes — giving you flexibility to migrate at your own pace.

Prerequisites

RequirementDescription
Reponse workspaceActive workspace with owner or admin role
ProductsAt least one product in the catalog
API key (optional)Key with discounts:read, discounts:write scopes for API access

Discount types

TypeCodeDescription
PercentagepercentageReduces price by a percentage (e.g. 15% off)
Fixed amountfixed_amountReduces price by a fixed amount (e.g. €10 off)
Free shippingfree_shippingRemoves shipping cost
Buy X Get YbxgyBuy a quantity of product X, get product Y free/discounted

Discount classes

ClassBehavior
codeShopper must enter a code at checkout
automaticApplied automatically when conditions are met

Step 1 — Create a discount code

Via the dashboard

  1. Go to Dashboard → Discounts → Create.
  2. Fill in code, type, value, and optional conditions.
  3. Click Save.

Via the API

typescript
import { createDiscountCode } from '@/lib/discount.actions';

const discount = await createDiscountCode('ws_xxx', {
  code: 'SUMMER25',
  type: 'percentage',
  value: 25,
  currency: 'EUR',
  starts_at: '2026-06-01T00:00:00Z',
  end_at: '2026-08-31T23:59:59Z',
  conditions: 'Minimum order €50',
});

Step 2 — Configure conditions and targeting

FieldTypeDescription
applies_to_typeall | products | collectionsWhat the discount applies to
applies_to_idsstring[]Product or collection IDs (when not all)
min_order_amountnumberMinimum cart total to qualify
min_quantitynumberMinimum item quantity to qualify
customer_eligibilityall | segmentWho can use the discount
customer_segment_idsstring[]Specific customer segments (when segment)
tier_requiredstringLoyalty tier required (e.g. Gold)

Step 3 — Schedule discounts

Control when discounts are active:

typescript
await createDiscountCode('ws_xxx', {
  code: 'FLASH50',
  type: 'percentage',
  value: 50,
  starts_at: '2026-07-04T08:00:00Z',   // starts July 4 at 8 AM
  end_at: '2026-07-04T20:00:00Z',       // ends same day at 8 PM
});
FieldDescription
starts_atISO 8601 date when the discount becomes active
end_atISO 8601 date when the discount expires

Discounts outside their active window are rejected with `"Discount code is not active yet"` or `"Discount code has expired"`.

Step 4 — Set usage limits

FieldTypeDescription
usage_limit_totalnumberMax total uses across all customers
usage_limit_per_customernumberMax uses per individual customer

When the total usage limit is reached, the code returns `"Discount code usage limit reached"`.

Combining discounts

Reponse supports stacking multiple discount codes on a single cart. The combinator engine groups discounts by kind and applies them in order:

  1. Product discounts — applied to line items first
  2. Order discounts — applied to the subtotal
  3. Shipping discounts — applied to shipping cost
typescript
import { useDiscountCodes } from '@/lib/discount.actions';

const result = await useDiscountCodes(
  ['disc_1', 'disc_2'],  // discount code IDs
  'lead_xxx',
  150.00                  // original cart total
);
// result → { success: true, discountAmount: 25.00, finalAmount: 125.00 }

Control stacking with the `combines_with` field:

json
{ "combines_with": ["product", "shipping"] }

Bulk code generation

Generate up to 500 unique codes from a template:

typescript
import { bulkCreateDiscountCodes } from '@/lib/discount.actions';

const result = await bulkCreateDiscountCodes('ws_xxx', {
  prefix: 'VIP',
  count: 100,
  type: 'percentage',
  value: 20,
  end_at: '2026-12-31T23:59:59Z',
  usage_limit_per_customer: 1,
});
// result → { created: 100, codes: ["VIP-A3K7X", "VIP-B9M2R", ...] }

Codes are generated with confusable characters removed (no `I`, `O`, `0`, `1`).

Applying to a cart

Automatic discounts

Automatic discounts are reflected when you fetch a cart — no action needed.

Code discounts

typescript
// Via SDK
await reponse.cart.applyPromo({
  path: { id: cartId },
  body: { code: 'SUMMER25' },
});

// Via REST API
// POST /v1/cart/:id/promo
// { "code": "SUMMER25" }

API reference

EndpointMethodDescription
/v1/discountsGETList discount codes for the workspace
/v1/discountsPOSTCreate a new discount code
/v1/discounts/:idGETGet a discount code by ID
/v1/discounts/:idPATCHUpdate a discount code
/v1/discounts/:idDELETEDelete a discount code
/v1/discounts/bulkPOSTBulk-generate discount codes
/v1/cart/:id/promoPOSTApply a promo code to a cart

Troubleshooting

SymptomCauseFix
"Discount code not found"Code doesn't exist or is inactiveCheck spelling and is_active flag
"Discount code has expired"Current date is past end_atUpdate or remove the expiry
"Usage limit reached"usage_limit_total exceededIncrease the limit or create a new code
Code not combiningMissing combines_with configSet the combines_with field on each code
Automatic discount not appliedConditions not metVerify min_order_amount and applies_to_type
Bulk generation returns fewer codesCollision limit reachedUse a longer prefix or reduce count
PreviousLoyalty Program
NextSubscriptions