Skip to main content
Discount codes overview cover
Discount codes let you run targeted promotions and incentives. Create percentage or fixed-amount discounts, set limits and expirations, restrict to products, and apply them seamlessly in checkout.

What Are Discount Codes?

Discount codes are promotional tokens that reduce order totals at checkout. They’re ideal for:
  • Seasonal campaigns: Black Friday, product launches, or anniversaries
  • Acquisition offers: First‑purchase incentives or referral rewards
  • Retention: Win‑back or loyalty rewards for existing customers
  • B2B deals: Contracted or negotiated pricing via private codes

Key Benefits

  • Flexible discounts: Percentage or fixed amount off
  • Targeted control: Restrict by product and subscription cycles
  • Campaign governance: Expiration dates and usage limits
  • Seamless checkout: UI field and API support via checkout sessions

Creating Discount Codes

Create discount codes in your Dodo Payments dashboard, then apply them in hosted checkout or via API.

Dashboard setup

  • Discount Name (required): Internal and dashboard display name
  • Code (required): The string customers enter at checkout
  • Type & Amount (required): Set a percentage or fixed‑amount value, or generate a random code using the button provided
  • Expiration Date (optional): Date after which the code becomes invalid
  • Usage Limit (optional): Max total redemptions across all customers
  • Product Restriction (optional): Limit applicability to selected products
  • Subscription Cycle Limit (optional): Number of billing cycles the discount applies to
Use cycle limits for introductory pricing on subscriptions (e.g., “50% off for 3 months”).

Checkout Experience

  1. Shoppers enter the code in the checkout field.
  2. Eligible discounts are applied and totals update immediately.
In Checkout Sessions, pass discount_code to pre‑apply a code, and set feature_flags.allow_discount_code to show the input field.

API Management

Create discount codes programmatically with type and amount.

API Reference

View the create discount API.
List all discounts or retrieve details for management and auditing.

API Reference

Browse listing and retrieval APIs.
Modify discount configuration such as amount, expiration, or restrictions.

API Reference

Learn how to update discount details.
Check whether a discount is valid and applicable before applying.

API Reference

Validate discount usage.
Deactivate or remove discounts that are no longer needed.

API Reference

Delete a discount.

Common Use Cases

  • Intro offers: Limited‑time launch promotions for new products
  • Bulk or B2B: Contracted discounts for select product sets
  • Retention plays: Win‑back codes in churn‑prevention workflows
  • Seasonal campaigns: Holiday or event‑based promotions

Integration Examples

Apply a discount in Checkout Sessions

Pre‑apply a discount and show the code input UI.
const session = await client.checkoutSessions.create({
  product_cart: [
    { product_id: 'prod_abc', quantity: 1 }
  ],
  discount_code: 'BLACKFRIDAY2024',
  customer: { email: 'user@example.com', name: 'Jane Doe' },
  return_url: 'https://yoursite.com/return'
});

Enable discount entry without pre‑applying

Let customers enter a code at checkout without passing one upfront.
const session = await client.checkoutSessions.create({
  product_cart: [
    { product_id: 'prod_abc', quantity: 1 }
  ],
  feature_flags: {
    allow_discount_code: true
  },
  return_url: 'https://yoursite.com/return'
});

Best Practices

  • Name clearly: Use recognizable codes that match campaign names
  • Time‑box: Add expirations to drive urgency and prevent misuse
  • Scope wisely: Limit to specific products to avoid margin leakage
  • Validate early: Check code applicability before confirming checkout
  • Monitor impact: Track usage and conversion by campaign
Discount codes are powerful levers for acquisition and retention. Start with simple, well‑named offers, validate thoroughly, and iterate based on performance.
I