LAUNCH20: 20% off Pro or Team for the first 3 months.Run launch deals, partner codes and one-off offers straight from your catalog. A discount lowers what the customer pays, never what they get: Ledger grants the plan’s full credits and allowances on every discounted invoice, even one discounted to $0. Ledger keeps your coupons and their promotion codes in the catalog as
rewards, makes them in your Stripe account, and checks and counts every code. Stripe takes the discount off the customer’s invoices.
A reward is a coupon or a grant. A coupon takes money off the plan. A grant code hands out credits or a metered feature’s units the moment it’s redeemed, such as WELCOME for 500 free credits. The same rewards pay out referral programs.
The catalog
POST /v1/rewards.
A catalog without
rewards leaves your rewards as they are. A catalog with rewards states all of them: one left out is archived and its codes deactivated, while discounts already on customers’ bills run to their end.
Durations
What a coupon covers
A coupon discounts the price and the seats of the plans it names. Usage, which bills under the plan’s<Plan> – overage product, and credit packs keep their full price. To give a customer more usage, give them credits.
A percentage coupon discounts a plan in any currency, and a fixed-amount coupon is in US dollars.
Changing a reward
Changing a reward’s amount, duration or plans makes a new Stripe coupon, since Stripe fixes a coupon’s terms when it’s made. Customers who already have the discount keep its terms, as plan versions keep their price. Every active code moves to the new coupon with its remaining uses.GET /v1/rewards shows each coupon’s stripeSyncStatus: synced, pending while its plans wait for their Stripe products, or failed with stripeSyncError. Ledger retries every hour. A grant lives in Ledger alone, so its status is null.
Grant codes
A grant reward gives the customer credits, or a metered feature’s units, the moment they redeem its code: a welcome bonus, a support make-good, or a partner’s free usage.ledger.catalog.json
The customer redeems a grant code in your app: the redemption is
active at once, with what it gave in grants. The same checks and limits apply as for coupons: one use per customer of a reward, maxRedemptions across customers, firstTimeOnly and the rest.
Each item is its own grant, starting at the customer’s now (their test clock’s time on a test clock). Credits join the customer’s balance and send credits.granted with source: "reward" and the rewardId. Granted units add to the feature’s allowance. Both are spent with the customer’s other grants in the usual spend order: whatever would be lost soonest first, and among credits that never expire, a reward’s before credit packs and adjustments, so refunding a pack takes back its own credits. Changing a grant’s items changes what later redemptions get; grants already given stay with the customer, through archiving the reward and through refunds.
Promotion codes
A code is unique among your active codes. Add a code through the API for one deal, withcustomerId to limit it to that customer. A catalog push leaves API codes alone. Deactivate a code to stop new redemptions.
Before a code is used, Ledger checks it exists and is active, hasn’t expired, is for this customer if it names one, meets firstTimeOnly, and hasn’t been redeemed by this customer before (or, with oncePerCustomer, any code of the reward). Each use counts against the code’s and the reward’s maxRedemptions the moment it’s redeemed.
Redeem a code
A customer gets a coupon in one of three ways.In your app
Send the code from a field in your app toPOST /v1/customers/redemptions:
appliesFrom: "next_invoice"). Otherwise it waits for their next attach of a plan it covers (appliesFrom: "next_attach"), and that attach applies it without a code. An Idempotency-Key header replays the first redemption.
On attach
Send the code aspromotionCode with attach. Checkout opens with the discount on, or a saved card is charged the discounted price. A lifetime plan with a code always goes through Checkout.
At Checkout
SendallowPromotionCodes: true with attach to show Stripe’s promotion code field in Checkout, for plans (lifetime ones too) and credit packs.
- Any code active in your Stripe account works: your Ledger codes, on the plans they cover, and codes you made in the Dashboard.
- A Ledger code typed in Checkout is recorded and counted from Stripe’s events, like any other redemption.
- A paid plan always goes through Checkout with the field on, even for a customer with a saved card, so they have somewhere to type the code.
- A pack or lifetime plan bought with a code that takes 100% off completes without a payment and still grants in full.
- The field applies when Checkout opens. Repeating an attach while its Checkout is open returns the same session.
One discount per bill
A subscription carries one Ledger coupon at a time. A second one waits asqueued and goes on when the first ends, so three “1 month free” coupons give three months in a row. Coupons you add in Stripe stay on the subscription beside Ledger’s.
Ledger puts redeemed coupons on subscriptions in the background, and waits while an upgrade or downgrade is in flight. A coupon attached with a trial waits through it: Ledger puts it on the subscription in the trial’s last two days, so a coupon for 2 months discounts the first two paid invoices. A once coupon goes on the next renewal invoice rather than the subscription, so it discounts the renewal even when another invoice comes first, such as a seat change charged now.
The customer’s discounts
GET /v1/customers returns the customer’s pending, queued and active Ledger coupons as discounts, each with its status, appliesFrom, discount and endsAt. List a customer’s redemptions returns every one, with endedReason once it ends: duration, subscription_ended or removed. discounts holds Ledger’s coupons; coupons added in Stripe live on the Stripe subscription, and nextChargeCents shows the list price.
Each redemption sends a reward.redeemed webhook with redemptionId, customerId, rewardId and status.
Coupons added in Stripe
A coupon you add in Stripe, on the subscription or on an invoice before it’s finalized, works the same way: it lowers the price, never the grants. Ledger checks the plan’s line at your full price before the discount, and tax is calculated on the discounted amount. A Dashboard coupon for every product discounts overage too.What a discount changes
Plan changes
A discount stays on the subscription through upgrades and downgrades, with its end date unchanged. It discounts the new plan when its coupon covers it; otherwise it stays on the bill and covers again on a move back within its duration. A period-end downgrade keeps the discount on both phases of its schedule. The upgrade and downgrade replies say what happened to a Ledger coupon indiscount: { rewardId, covered, endsAt }, or null when the bill has none.
Refunds
A prorated downgrade refund is on what the customer paid. A customer on 50% off gets half the list-price refund, never more than they paid.Errors
Rules
- A coupon covers up to 100 Stripe Products: each paid plan it names, plus their seat Products. One that would cover more syncs as
failedwithstripeSyncError: "too_many_products"; name the plans it’s for inplanIds. - A code must be unique across your Ledger rewards and your Stripe account; a code already active in the Stripe Dashboard stops the reward syncing (
promotion_code_taken) until you deactivate one of the two. - Send
promotionCodeorallowPromotionCodeson an attach, not both. - A reward is a
couponor agrantand keeps its kind; give the other kind a new ID. - Grant codes give credits and metered units, and are redeemed through
POST /v1/customers/redemptions; attach and Checkout take coupon codes (422 promotion_code_not_a_discount). - Granted metered units count while the customer’s plan or an add-on includes the feature, even with 0 included (
feature_not_in_planotherwise). - A
promotionCodeon attach covers the plan (422 promotion_code_not_for_plan). - Discount with coupons, not Stripe customer balances: an invoice paid from a balance grants nothing, and attach answers
409 stripe_customer_balancefor a customer with one. See Renewals and lifecycle.