Discounts
Promotional codes, percentage off, fixed amounts, and free trials
Discounts let you offer promotional pricing to customers. Create discount codes that customers can apply at checkout, or apply discounts directly to orders and subscriptions.
Discount Types
Percentage Off
Reduce the total by a percentage (e.g., 20% off).
Example: $100 with 20% off = $80
Fixed Amount
Reduce the total by a specific amount (e.g., $25 off).
Example: $100 with $25 off = $75
Free Trial
Extend the trial period for subscriptions (e.g., 30-day trial instead of 14).
Example: Add 30 days free trial period
Discount Fields
| Field | Type | Description |
|---|---|---|
code | string | Discount code customers enter (e.g., SUMMER20) |
type | enum | percentage, fixed, or free_trial |
amount_off | integer | Fixed amount in minor units (for fixed type) |
percent_off | number | Percentage discount (for percentage type) |
trial_days | integer | Trial period in days (for free_trial type) |
max_redemptions | integer | Maximum number of times discount can be used |
expires_at | datetime | When the discount code expires |
is_active | boolean | Whether discount is currently usable |
Discount Scope
Control what the discount applies to:
| Scope | Description |
|---|---|
entire_order | Applies to the total order/subscription amount |
specific_products | Only applies to selected products |
subscription_only | Only valid for recurring purchases |
one_time_only | Only valid for one-time purchases |
Creating Discounts
Via Dashboard
- Navigate to Product → Discounts
- Click + New Discount
- Enter discount code (e.g., SUMMER20)
- Select discount type and amount
- Configure scope and limits
- Save the discount
Via API
// Percentage discount
const discount = await client.discounts.create({
code: 'SUMMER20',
type: 'percentage',
percentOff: 20,
// Optional limits
maxRedemptions: 100,
expiresAt: '2025-08-31T23:59:59Z',
// Optional: Limit to specific products
productIds: ['prod_xxx', 'prod_yyy'],
});
// Fixed amount discount
const fixedDiscount = await client.discounts.create({
code: 'SAVE25',
type: 'fixed',
amountOff: 2500, // $25.00
currency: 'USD',
});
// Free trial extension
const trialDiscount = await client.discounts.create({
code: 'FREETRIAL30',
type: 'free_trial',
trialDays: 30,
});Using Discounts
At Checkout
For checkout links, enable discount codes in the link settings:
- Edit the checkout link
- Enable Allow discount codes
- Customers will see a discount code input field
- Valid codes are applied automatically
Via API
// Apply discount to a subscription
const subscription = await client.subscriptions.create({
customerId: 'cus_xxx',
items: [{ priceId: 'price_xxx' }],
discountId: 'disc_xxx', // Apply the discount
});
// Apply discount to an order
const order = await client.orders.create({
customerId: 'cus_xxx',
lineItems: [{ priceId: 'price_xxx', quantity: 1 }],
discountId: 'disc_xxx',
});Tracking Redemptions
Track how discounts are being used:
- Redemption count - How many times the code has been used
- Total discounted - Sum of all discount amounts applied
- Revenue impact - How much revenue was affected
Best Practices
SUMMER20, WELCOME10, BLACKFRIDAY are easy to remember and type
Create urgency and prevent indefinite discount usage
Control promotion costs by capping total uses
Monitor redemption rates and revenue impact
Set is_active: false to preserve history