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

FieldTypeDescription
codestringDiscount code customers enter (e.g., SUMMER20)
typeenumpercentage, fixed, or free_trial
amount_offintegerFixed amount in minor units (for fixed type)
percent_offnumberPercentage discount (for percentage type)
trial_daysintegerTrial period in days (for free_trial type)
max_redemptionsintegerMaximum number of times discount can be used
expires_atdatetimeWhen the discount code expires
is_activebooleanWhether discount is currently usable

Discount Scope

Control what the discount applies to:

ScopeDescription
entire_orderApplies to the total order/subscription amount
specific_productsOnly applies to selected products
subscription_onlyOnly valid for recurring purchases
one_time_onlyOnly valid for one-time purchases

Creating Discounts

Via Dashboard

  1. Navigate to Product → Discounts
  2. Click + New Discount
  3. Enter discount code (e.g., SUMMER20)
  4. Select discount type and amount
  5. Configure scope and limits
  6. 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:

  1. Edit the checkout link
  2. Enable Allow discount codes
  3. Customers will see a discount code input field
  4. 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
View discount analytics in Product → Discounts by clicking on any discount.

Best Practices

1.
Use memorable codes

SUMMER20, WELCOME10, BLACKFRIDAY are easy to remember and type

2.
Set expiration dates

Create urgency and prevent indefinite discount usage

3.
Limit redemptions

Control promotion costs by capping total uses

4.
Track performance

Monitor redemption rates and revenue impact

5.
Deactivate, don't delete

Set is_active: false to preserve history

Related