Bypassing the App Store Tax: A Complete Web-to-App Subscription Guide
Apple and Google charge a 15% to 30% fee on all purchases made using their native billing systems. For bootstrapped developers or companies operating on thin margins, this "app store tax" is a massive headwind. Fortunately, under recent regulatory updates, developers are allowed to direct users to external web portals for subscription signups.
The Web-to-App Architecture Flow
The core concept is simple: users pay on your website, and their entitlements are unlocked when they log into your native mobile app. Here is the detailed engineering flow:
[ User Checkout ] ===> ( Stripe Portal ) ===> [ Stripe Webhook ]
||
v
[ Sync App Entitlements ] <=== ( App Launch API ) <=== [ Postgres DB ]
1. Processing Stripe Webhook Events
Below is a production-ready Express handler verifying Stripe webhook signatures and inserting a record into the user entitlement table:
import express from 'express';
import Stripe from 'stripe';
import { db } from '../db';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: '2023-10-16' });
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET!;
export async function handleStripeWebhook(req: express.Request, res: express.Response) {
const sig = req.headers['stripe-signature']!;
let event: Stripe.Event;
try {
event = stripe.webhooks.constructEvent(req.body, sig, webhookSecret);
} catch (err: any) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
if (event.type === 'customer.subscription.created' || event.type === 'customer.subscription.updated') {
const subscription = event.data.object as Stripe.Subscription;
const userId = subscription.metadata.user_id;
const expiresAt = new Date(subscription.current_period_end * 1000);
await db.query(
`INSERT INTO entitlements (user_id, name, source, expires_at)
VALUES ($1, $2, $3, $4)
ON CONFLICT (user_id, name)
DO UPDATE SET expires_at = $4, source = $3`,
[userId, 'premium', 'stripe', expiresAt]
);
}
res.json({ received: true });
}
2. Syncing Entitlements in iOS (Swift)
When the app launches, it queries the backend API to retrieve active entitlements. If Stripe reports an active subscription, local premium paths are unlocked immediately:
class SubscriptionManager {
static let shared = SubscriptionManager()
private var activeEntitlements: Set = []
func syncEntitlements(completion: @escaping (Bool) -> Void) {
guard let url = URL(string: "https://api.billdog.io/v1/entitlements") else { return }
var request = URLRequest(url: url)
request.setValue("Bearer \(Auth.shared.token)", forHTTPHeaderField: "Authorization")
URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
completion(false)
return
}
if let decoded = try? JSONDecoder().decode([String].self, from: data) {
self.activeEntitlements = Set(decoded)
completion(self.activeEntitlements.contains("premium"))
}
}.resume()
}
}
Navigating App Store Link Rules
While web checkout is legal, both Apple and Google enforce strict guidelines on how you link to it from within the app. You must use correct phrasing (e.g. "To manage your account, visit your account dashboard on our website") and utilize official external link entitlement APIs where required. Avoid using language that explicitly prompts users to "buy on web to save 30%" inside the native binary, as this will lead to rejection during review.
Get the BillDog newsletter
Practical guides on subscription pricing, paywalls and app growth, about twice a month. No spam.
