affiliate-coupon
Create a 30%-off coupon for an affiliate or creator on iOS and Android, and draft the reply that tells them how to use it. Use when asked to create, set up or send a coupon or promo code for an affili
SKILL.md.claude/skills/affiliate-coupon/SKILL.md
GitHubAffiliate coupon
Create the coupon: $ARGUMENTS
How redemption works
- iOS: "Redeem coupon" opens Apple's own code sheet (
Thunk_redeemCouponIOS). The code must be an App Store Connect offer code. Our server is never called. - Android: "Redeem coupon" opens our
couponModal, which calls/api/coupon/claim/:codeand reads thelftCouponsrow. The claim response carriesaffiliate, and the app records it withStorage_setAffiliate(affiliate, "coupon"). - An Apple custom code belongs to one offer, and an offer covers one plan. So iOS gets two codes:
<CODE>for yearly and<CODE>MONTHLYfor monthly. An optional third argument replaces the monthly code, e.g.MLTRY military MLTRYMONTH. Android uses<CODE>for both plans. - Apple offer names must be unique across both subscriptions. The script names them
<AFFILIATE_ID>(yearly) and<AFFILIATE_ID>-monthly. - iOS redemptions never write an
lftAffiliatesrow, so the affiliate dashboard does not count them. Apple reports the offer on the payment asofferIdentifier. - Program imports are counted when the link carries
?s=<AFFILIATE_ID>.
Steps
- Pick the values.
CODEis 3 to 20 letters or digits, usually the creator's name in capitals.AFFILIATE_IDis a short lowercase id. Use the same id for the coupon and for the program link. - Dry run.
--dry-rundoes not work, becausenpm runtakes that flag for itself. Use the env var:DRY_RUN=1 npm run r lambda/scripts/create_affiliate_coupon.ts <CODE> <AFFILIATE_ID> - Show the dry run output to the user and wait for approval. The real run writes to App Store Connect and to the prod
lftCouponstable, and Apple offer codes cannot be deleted through the API. - Run it:
npm run r lambda/scripts/create_affiliate_coupon.ts <CODE> <AFFILIATE_ID>. A rerun skips everything that exists, so a run that failed halfway can be repeated. - Draft the reply to the affiliate:
- iPhone: the "Redeem coupon" link at the bottom of the subscription screen, then enter
<CODE>for 30% off yearly, or<CODE>MONTHLYfor 30% off monthly. - Android: the same button, enter
<CODE>, then pick a plan. - The user must sign in before redeeming on Android.
- Program link: share the program, then add
?s=<AFFILIATE_ID>to the link.
- iPhone: the "Redeem coupon" link at the bottom of the subscription screen, then enter
Files
lambda/scripts/create_affiliate_coupon.tsruns the whole flow.lambda/scripts/appleOfferCodes.tscalls the App Store Connect API withlambda/scripts/AuthKey_F286YBUYZ7.p8. Price points are cached inpricepointscache/. Target prices come fromlambda/scripts/apple_prices.csv.- The Android offers (
monthly-discount-30,yearly-discount-30) already exist in Google Play. Nothing is created there.