Actions84
- Affiliate Actions
- Checkout Actions
- Customer Actions
- Discount Actions
- Discount Redemption Actions
- File Actions
- License Key Actions
- License Key Instance Actions
- Order Actions
- Order Item Actions
- Price Actions
- Product Actions
- Store Actions
- Subscription Actions
- Subscription Invoice Actions
- Subscription Item Actions
- Usage Record Actions
- User Actions
- Variant Actions
- Webhook Actions
Discount → Create
AI-generatedSummary
Creates a discount code in a Lemon Squeezy store, either percentage-based or fixed-amount, with optional duration, redemption limits, validity dates, test mode and product/variant restrictions.
Inputs
- discountStoreId (required) — Store the discount belongs to; pick from the list or supply an ID via expression.
- discountName (required) — Internal name, not shown to customers.
- discountCode (required) — Code customers enter at checkout.
- discountAmount (required) — Percent type: 0-100. Fixed type: amount in cents (1000 = $10.00). The handler validates the amount against the chosen type before calling the API.
- discountAmountType — Percent (default) or Fixed.
- additionalOptions — Optional collection: Duration (once, repeating, forever), Duration In Months (for repeating), Max Redemptions (0 = unlimited), Starts At, Expires At (ISO 8601), Test Mode, Limit to Products, and Variant IDs (comma-separated, needs Limit to Products).
- simplifyOutput — Simplify (default true) flattens JSON:API attributes to the top level. Turn it off to get the raw type/attributes/relationships structure.
- retryOptions — Max Retries (default 3, 0 disables) and Initial Delay in ms (default 1000, doubles each retry) for failed API requests.
Output shape
A single item for the created discount. With Simplify on, it has id, type and the discount attributes (name, code, amount, amount type, duration, status and so on) at the top level. With Simplify off, it is the raw JSON:API resource.
Inputs are validated before the request (required fields, discount amount against its type), and invalid input throws an error. Rate-limit (429) and 5xx/network errors are retried with exponential backoff. The exact attribute list returned depends on the Lemon Squeezy API.
Examples
Example 1: Create a 25% off launch code for all products
Store: your store; Name: Launch promo; Code: LAUNCH25; Amount: 25; Amount Type: Percent.
Example 2: Create a $10 off code for the first 100 customers, limited to specific variants
Amount: 1000; Amount Type: Fixed; Additional Options: Max Redemptions 100, Limit to Products on, Variant IDs '123,456'.
Example 3: Create a 3-month subscription discount that expires at year end
Amount: 20, Percent; Additional Options: Duration Repeating, Duration In Months 3, Expires At 2026-12-31T23:59:59Z.