Sub topic 15
Refunds, leaked codes and abuse
This chapter assumes you have read the earlier chapters on coupon types, Udemy coupons and own-site coupon rules. It covers three ways a sale can earn less than you planned: the buyer gets a refund, a coupon spreads beyond its audience, or someone games the rules. Coupon sites that republish codes are only one of these. Measure each one and set limits that cap the loss.
How refunds change what you keep
A refund undoes a sale after you counted it. Your net revenue per sale from earlier chapters is only valid for sales that stick.
- On Udemy, the marketplace sets and runs the refund policy. It has offered a refund window for learners, and refunded sales are taken out of instructor earnings. You cannot approve or deny a refund. Check the current instructor terms for the exact window and payout timing.
- On your own site, you write the refund policy and you issue refunds through your payment processor. Many processors keep the fee they charged on the original payment when you refund, so each refund costs you the fee as well as the price. Check your processor's current fee terms.
The calculation below shows the effect. It reuses the assumed 2.9% + 0.30 fee from the pricing chapters. That rate is an example, not a quote.
from decimal import Decimal, ROUND_HALF_UP
CENT = Decimal("0.01")
FEE_RATE = Decimal("0.029")
FEE_FIXED = Decimal("0.30")
def money(x: Decimal) -> Decimal:
return x.quantize(CENT, rounding=ROUND_HALF_UP)
def fee(price: Decimal) -> Decimal:
return money(price * FEE_RATE + FEE_FIXED)
def net_after_refunds(price: Decimal, sales: int, refunds: int) -> Decimal:
"""Own-site net when the processor keeps its fee on refunded sales."""
collected = price * sales
returned = price * refunds
fees = fee(price) * sales
return collected - returned - fees
price = Decimal("69.30")
print(net_after_refunds(price, 100, 0)) # 6699.00
print(net_after_refunds(price, 100, 8)) # 6144.60Eight refunds out of 100 sales cost 554.40 in returned price plus nothing recovered on fees. Net drops by about 8.3%, a little more than the 8% refund rate, because the fees on the refunded sales are lost.
Read refund rate by source
A single refund rate hides the problem. Split it by coupon, traffic source and price paid. Heavy discounts often bring buyers who bought on impulse and refund more, while a full-price audience usually has a lower refund rate. If a deep-discount code shows a refund rate well above your average, the effective net of that promotion is lower than its conversion numbers suggest. Feed refund-adjusted net revenue into the measuring methods from the previous chapter.
Reduce refunds before they happen
- State the outcome, prerequisites and level on the sales page, so buyers know what they are getting.
- Offer a free preview lesson or sample, so the first impression comes before the purchase.
- Check the first-week experience: a clear starting lesson, working downloads, and a prompt answer to questions.
- Read refund reasons. Repeated reasons ("too advanced", "audio quality") point at a course or listing fix, not a pricing fix.
Leaked codes
A leaked code is a coupon that reaches people you did not intend. Typical routes are a coupon-aggregator site, a forum post, a screenshot of your email, or a customer sharing it.
What leakage costs
The direct cost is a discount given to buyers who would have paid more. The indirect cost is larger. If a deep discount is easy to find, buyers learn to search for it, which is the "waiting for discounts" effect from the strategy chapter. It also undermines the price consistency you built across channels.
Controls on Udemy
Udemy lets you set the coupon's limits when you create it, within the platform's rules. Use what the dashboard offers:
- Short validity periods, so a leaked code dies quickly.
- Redemption caps on coupons you share publicly.
- Separate codes per audience or campaign, so you can see which one leaked.
Your control stops there. You cannot see who redeemed a code beyond the aggregate figures Udemy shows, and Udemy runs its own promotions separately. Plan for some leakage by treating every Udemy code as public once it is sent to more than a handful of people.
Controls on your own site
On your own site you can enforce far more. The table shows which control addresses which problem.
| Control | Stops | Weakness |
|---|---|---|
| Expiry date | Old codes circulating for months | Leaked code still works until expiry |
| Total redemption cap | Unlimited spread of one code | One bad actor can use the whole cap |
| One use per customer | Repeat use by the same person | New email addresses get around it |
| Unique single-use codes | Sharing, since each code works once | More work to generate and send |
| Eligibility rule (list, product, first purchase) | Use by the wrong audience | Needs reliable customer data |
For private offers such as an email-list discount, generate unique single-use codes per recipient. A shared code like SPRING30 is only suitable when you accept that it may go public.
Enforcing limits correctly
A common error is checking the cap and recording the redemption as two separate steps. Two buyers checking at the same moment can both pass the check, so a cap of 100 allows 102 uses. The check and the update must happen as one atomic operation.
The sketch below uses SQLite from Python's standard library. The redemption row and the counter update succeed or fail together.
import sqlite3
db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE coupons (
code TEXT PRIMARY KEY,
max_redemptions INTEGER NOT NULL,
redeemed INTEGER NOT NULL DEFAULT 0
);
CREATE TABLE redemptions (
code TEXT NOT NULL,
email TEXT NOT NULL,
PRIMARY KEY (code, email)
);
""")
db.execute("INSERT INTO coupons (code, max_redemptions) VALUES ('SPRING30', 2)")
def redeem(code: str, email: str) -> str:
email = email.strip().lower()
try:
with db: # one transaction: commit on success, roll back on error
db.execute("INSERT INTO redemptions VALUES (?, ?)", (code, email))
cur = db.execute(
"UPDATE coupons SET redeemed = redeemed + 1 "
"WHERE code = ? AND redeemed < max_redemptions",
(code,),
)
if cur.rowcount == 0:
raise LookupError("Unknown code or fully redeemed")
except sqlite3.IntegrityError:
return "Already used by this email"
except LookupError as err:
return str(err)
return "OK"
print(redeem("SPRING30", "[email protected]")) # OK
print(redeem("SPRING30", "[email protected]")) # Already used by this email
print(redeem("SPRING30", "[email protected]")) # OK
print(redeem("SPRING30", "[email protected]")) # Unknown code or fully redeemedThe primary key on (code, email) enforces one use per customer. The WHERE redeemed < max_redemptions clause enforces the cap inside the same statement that increments the counter. When the update matches no row, the exception rolls back the redemption insert, so a failed attempt leaves no trace.
In a real shop, do this inside the same transaction as order creation, and release the redemption if payment fails.
Gotchas
- Lowercase and trim email addresses, as the code does. Even so,
[email protected]and[email protected]often reach the same mailbox, so an email limit is a speed bump, not a wall. - Tie limits to the account or payment method when you can. That is harder to dodge than an email address.
- Apply the discount on the server. A coupon check that runs only in the browser can be bypassed.
- Never reveal whether a code exists with different error messages on a public endpoint, and rate-limit attempts, so nobody can guess codes by brute force.
Other forms of abuse
- Buy, download, refund. A buyer takes the course files and requests a refund. On your own site, limit downloadable assets before the refund window ends, or watermark them. On Udemy, the platform handles refund eligibility rules.
- Account sharing. One purchase used by many people. Own-site platforms can limit concurrent sessions. Udemy governs this through its own terms.
- Chargebacks. A buyer disputes the payment with their bank instead of asking you. Chargebacks usually cost a dispute fee on top of the lost sale, and too many can put your payment account at risk. A clear refund policy and easy contact route lower the chance that unhappy buyers go to their bank.
- Stacking. Two discounts applied to one order. Decide in advance whether codes can combine, and enforce the decision in code.
Monitoring
Set up a small routine and run it after each promotion:
- List redemptions per code per day. A sudden spike on a code you shared with a small list suggests a leak.
- Compare each code's refund rate with your average.
- Check the discounted-price floor from the margin chapter against the lowest price any live code produces.
- Retire any code that leaked, and replace it with a new one for the remaining audience.
The diagram shows the order of checks for an own-site redemption.
Accept some loss
No control removes abuse completely, and tight controls cost sales and support time. Decide what loss you accept. A rough rule: spend effort on a control only when the loss it prevents is larger than the work it takes. For a small course, expiry dates and a redemption cap are usually enough. For a large launch with many affiliates, unique codes and monitoring pay off.
Exercise
You sell a course on your own site at 69.30 after discount. You get 200 sales, 20 are refunded, and the processor keeps its fee (2.9% + 0.30, rounded to the cent) on refunded payments. What is your net revenue, and which two lines of the calculation does a refund affect?
Show answer
The fee per sale is 69.30 × 0.029 + 0.30 = 2.3097, which rounds to 2.31. Collected: 200 × 69.30 = 13,860.00. Refunded: 20 × 69.30 = 1,386.00. Fees: 200 × 2.31 = 462.00. Net = 13,860.00 − 1,386.00 − 462.00 = 12,012.00. A refund adds to the returned total and does not reduce the fees line, because the processor keeps the fee on refunded payments.
Exercise
Your redemption code first checks that a coupon's count is below its cap, then, in a separate statement, adds the redemption and increments the count. Describe the failure this allows and how to fix it.
Show answer
Two buyers can run the check at the same moment, both see the count below the cap, and both complete the redemption, so the cap is exceeded. Fix it by making the check and the increment one atomic operation, for example an UPDATE with "WHERE redeemed < max_redemptions" inside the same transaction as the redemption record, and reject the order when no row is updated.
Exercise
A code you sent to 50 email subscribers shows 400 redemptions in two days. List two likely explanations and two actions.
Show answer
Likely explanations: the code leaked to a coupon-aggregator site or public forum, or subscribers forwarded it widely. Actions: expire or disable the code and replace it with unique single-use codes for the remaining subscribers, then review the refund rate and net revenue of the 400 redemptions to see what the leak cost. Adding a redemption cap to future codes is also a valid action.