Promo demo pass$40.00
Working withsave25sandbox

Pick a discount

$40.00 list
Show the call that made save25
await whop.promoCodes.create({
  "account_id": "biz_...",
  "code": "SAVE25",
  "promo_type": "percentage",
  "amount_off": 25,
  "base_currency": "usd",
  "new_users_only": false,
  "promo_duration_months": 1,
  "unlimited_stock": true,
  "one_per_customer": false,
  "product_id": "prod_..."
})
Whop refuses a create that says nothing about stock, so one of stock or unlimited_stock is always in the body, even though both are documented as optional.

What Whop hands back

percentage
You send25whole percent
Whop returns0.25decimal fraction

Print 0.25 straight from a list call and your page offers 0.25% off where you meant 25%. Send it back unchanged and the create is refused, because the write side floors at 1.

Duration
once
Uses left
unlimited
Per customer
no limit
Audience
everyone
Every read is the fraction: create, retrieve, and list, including the code behind a payment. Convert once, at the edge, and never store the result.// lib/promo.ts
promoType === "percentage" ? Math.round(raw * 100) : raw

Let someone use it

Both checkouts have an Add promo code button. Type save25 there and pay with 4242 4242 4242 4242. On a narrow screen the embedded checkout folds the button under Promo code & details.

Hosted checkout ↗
What the checkout told us

Pay in the embedded checkout and onComplete fires. Whatever it hands over lands here, unedited.

The hosted checkout finishes on whop.com, so a purchase made there never reaches this page. Use the embedded one to follow the payment through to step 5.

Put it in a link

This pagehttps://nextjs-whop-promo-codes-demo.vercel.app/?promo=save25
Hosted checkouthttps://sandbox.whop.com/checkout/plan_KRJK9vttx9C9k?promoCode=save25
$40.00$30.00
what they see first
// the whole feature
<Checkout plan={planId} promoCode="save25">
<CheckoutElement />
</Checkout>
A code that no longer works still opens the checkout, at full price, and the checkout says why. Pause a code in step 6 and open its link to see it.

What the receipt says

Buy something to prove it

Until the server reads the payment back, a discount is only a number on a screen.

This product lists at $40.00. The payment itself records the price before the discount, what was charged, and which code did it.

Your codes

3 on Whop
  • active5 used
  • active1 used
  • active0 used
Pause and resume are reversible, so they are safe to hand a stranger. Archiving is not, so this demo leaves it out. Pause calls promoCodes.deactivate and resume calls promoCodes.activate.
Activity loglive

Everything the page does behind the scenes shows up here.