Affiliate codes for an indie app with no backend

One hidden in-app purchase per partner, and the stores do the bookkeeping. By Thomas Willheim · November 20, 2026

Hey y'all. HonorFit is the app blocker where you earn your screen time with pushups, on the honor system. It has no accounts and no server. Your data stays on your phone because there's nowhere else for it to go.

Then a creator asked if I had an affiliate program. I wanted one: they get a code, their audience gets 20% off Lifetime Pro, and they get 50% of what I make on each sale. But every affiliate setup I looked at assumes a backend that stores codes, tracks clicks and matches purchases to partners. I didn't want to build one just for this, and I really didn't want to break “nothing leaves your phone” to do it.

Here's what I did instead. It works on iPhone and Android, and it's a small paywall change plus one script on my laptop.

Why not the stores' own promo codes?

Apple has offer codes, but Google Play's promo codes for one-time products can only give the item away for free. There's no “20% off”. I wanted one code that works the same on both stores, so store codes were out.

And even with discounts, there's a second problem: I need to know whose code each sale came from, every month, to pay people.

The trick: every partner gets their own product

HonorFit already sells Lifetime Pro as a one-time purchase, honorfit_pro_lifetime, for $19.99. Each partner gets a copy of that product with their code in the ID, priced at $15.99:

honorfit_pro_lifetime            $19.99   (what everyone sees)
honorfit_pro_lifetime_p_alex20   $15.99   (only with the code ALEX20)

That one decision handles the three jobs a backend would normally do:

Nobody sees these products unless they type a code. In-app purchases don't show up in either store's listing unless you choose to promote them, so the partner products only exist for people who know the code.

The app side

The paywall got a small “Have a partner code?” link under Restore. Tapping it shows a text field. When someone enters a code, I clean it up and ask the store for that product. This uses expo-iap, but it's the same idea with StoreKit or Play Billing directly:

const PARTNER_PREFIX = 'honorfit_pro_lifetime_p_';

// "alex-20 " -> "ALEX20". Product IDs can't hold much else.
export function normalizePartnerCode(input: string) {
  const code = input.replace(/[\s-]/g, '').toUpperCase();
  return /^[A-Z0-9]{3,20}$/.test(code) ? code : null;
}

export async function lookupPartnerCode(code: string) {
  const sku = PARTNER_PREFIX + code.toLowerCase();
  const products = await fetchProducts({ skus: [sku], type: 'in-app' });
  const product = products?.find((p) => p.id === sku);
  return product ? { code, sku, price: product.displayPrice } : null;
}

If the product comes back, the Lifetime card shows $19.99 $15.99 and the buy button purchases the partner's product instead of the normal one. If not, the field says the code isn't valid. A store error gets its own message, so an offline phone doesn't tell someone their real code is fake.

HonorFit's Pro screen with partner code ALEX20 applied: Lifetime shows $19.99 crossed out and $15.99 one-time
The Pro screen after someone enters ALEX20.

The last piece is entitlement. Anywhere the app asked “is this a Pro product?”, it used to compare against a list of two IDs. Now it's a prefix check, so the purchase listener and Restore treat a partner purchase exactly like Lifetime:

export const isProSku = (sku: string) =>
  sku === MONTHLY_SKU || sku === LIFETIME_SKU || sku.startsWith(PARTNER_PREFIX);

Because codes are checked against the store, adding a partner never needs an app update. There's no list of codes in the app to keep current.

Creating the products by API

Making a product by hand in two consoles for every partner would get old fast, so bun run affiliate add ALEX20 "Alex" "alex@example.com" does both:

App Store Connect

  1. Create the in-app purchase (non-consumable) with the partner product ID.
  2. Copy the Lifetime product's display name and description in every language.
  3. Set a $15.99 US base price. Apple works out the other countries from it.
  4. Copy Lifetime's country availability, upload a review screenshot, and write a review note that tells the reviewer exactly where the code field is and which code to type.

Then bun run affiliate submit ALEX20 sends it to App Review. Every partner product is reviewed on its own, usually within a day or two. Apple only approves an in-app purchase its reviewer can actually reach, so the code field has to be in the live app first.

Google Play

My first try used the old inappproducts endpoint, which returned a 403 telling me to migrate. One-time products now live under oneTimeProducts, where a product holds one or more purchase options. The script:

  1. Copies Lifetime's listings and tax settings into a new one-time product.
  2. Runs pricing:convertRegionPrices on $15.99 to get a price for every region.
  3. Creates one buy purchase option with those prices, then activates it with purchaseOptions:batchUpdateStates.

Play products go live right away, no review.

Paying partners from the stores' reports

Once a month, bun run affiliate report 2026-11 pulls both stores' reports and works out what each partner earned:

Each partner gets 50% of the net, floored at zero, and the script writes a CSV I can pay from.

Play gotcha: the service account needs “View financial data” in Play Console to download earnings reports. After I turned it on, the account could list the files but still got a 403 downloading them for about a day. If yours does that, wait before you start changing bucket permissions.

The tradeoffs

Bonus: acknowledge purchases made outside your app

This one came up the same week. If someone redeems a Google Play promo code in the Play Store, the purchase happens outside your app, so your purchase listener never sees it. Google refunds any purchase that isn't acknowledged within 3 days. HonorFit now checks for owned purchases on launch and whenever it comes back to the foreground on Android, acknowledges any that aren't yet, and unlocks Pro.

Want a code?

As I write this, the program has zero partners. If you make stuff about fitness, focus, studying or screen time and you think your people would like HonorFit, the partner page has the details and a short form. Your audience gets 20% off Lifetime, and you get half of what I receive on every sale with your code.

HonorFit Blocker is a free app blocker for iPhone and Android. Earn screen time with pushups or any exercise you pick. Honor system, no camera, nothing leaves your phone.

Keep reading