Skip to main content
Discount codes give you powerful tools to incentivize purchases and run promotional campaigns. You can create percentage-based or fixed-amount discounts that apply to specific products, with full control over duration, expiration, and redemption limits.

Creating Discount Codes

Via Dashboard

  1. Navigate to Discounts in your Creem Dashboard
  2. Click Create Discount Code
  3. Configure your discount settings:
    • Name: Internal name for your reference (e.g., “Holiday Sale 2024”)
    • Code: Customer-facing code (e.g., “HOLIDAY50”)
    • Type: Percentage or fixed amount
    • Amount/Percentage: The discount value
    • Duration: How long the discount applies
    • Products: Which products this code applies to
    • Expiration Date: When the code expires (optional)
    • Max Redemptions: Limit total uses (optional)
  4. Click Create to activate the discount

Via API

You can also create discounts programmatically using the API.
  • TypeScript SDK
  • REST API
import { createCreem } from "creem_io";

const creem = createCreem({
  apiKey: process.env.CREEM_API_KEY!,
  testMode: process.env.NODE_ENV !== "production",
});

// Create a percentage discount
const percentageDiscount = await creem.discounts.create({
  name: "Percentage Discount",
  code: "PERC10",
  currency: "USD",
  type: "percentage",
  percentage: 10,
  duration: "forever",
});

// Create a fixed amount discount
const fixedDiscount = await creem.discounts.create({
  name: "Fixed Discount",
  code: "FIXED10",
  amount: 1000, // In cents
  currency: "USD",
  type: "fixed",
  duration: "forever",
});

Discount Types

Percentage Discounts

Reduce the price by a percentage (e.g., 25% off).
{
  "type": "percentage",
  "percentage": 25,
  "duration": "once"
}
A $100 product with a 25% discount becomes $75.

Fixed Amount Discounts

Reduce the price by a fixed amount in a specific currency (e.g., $20 off).
{
  "type": "fixed",
  "amount": 20,
  "currency": "USD",
  "duration": "once"
}
A $100 product with a $20 discount becomes $80.

Duration Options

Control how long a discount applies for subscriptions.

Once

Applies only to the first payment. Perfect for acquisition discounts.
{
  "duration": "once"
}
Use case: “Get 50% off your first month” for a monthly subscription.

Forever

Applies to all payments for the lifetime of the subscription.
{
  "duration": "forever"
}
Use case: “Lifetime 20% discount for early supporters” on a subscription.

Repeating

Applies for a specific number of months, then reverts to full price.
{
  "duration": "repeating",
  "durationInMonths": 3
}
Use case: “50% off for your first 3 months” on a subscription.
Duration only affects subscription products. For one-time payments, the discount is always applied once.

Applying Discount Codes

Customer-Entered Codes

Customers can enter discount codes directly at checkout. If the code is valid for the product and hasn’t expired, it will automatically apply. No implementation required - this works out of the box!

Pre-Applied Codes

Pre-apply a discount code programmatically when creating a checkout session. This is useful for landing pages, email campaigns, or special offers.
  • Next.js
  • TypeScript SDK
  • Better Auth
  • REST API
import { CreemCheckout } from "@creem_io/nextjs";

export function PromoButton() {
  return (
    <CreemCheckout
      productId="prod_YOUR_PRODUCT_ID"
      discountCode="LAUNCH50"
    >
      <button>Claim 50% Off</button>
    </CreemCheckout>
  );
}

Managing Discount Codes

Retrieve a Discount

Get details about a specific discount code.
  • TypeScript SDK
  • REST API
// By discount ID
const discount = await creem.discounts.get({
  discountId: "disc_1234567890",
});

// By discount code
const discount = await creem.discounts.get({
  discountCode: "LAUNCH50",
});

console.log(discount.redeem_count); // See how many times it's been used

Delete a Discount

Permanently delete a discount code. This action cannot be undone.
  • TypeScript SDK
  • REST API
await creem.discounts.delete({
    discountId: "disc_1234567890",
});

Next Steps