Add a paywall to a React Native or Expo app
To add a paywall to a React Native or Expo app with BillDog, install @billdog.io/react-native (plus @billdog.io/expo for Expo) and its four native peers, call BillDogConfiguration.configure({ apiKey }), then await BillDog.register('onboarding'). Expo apps need a development build, because Expo Go can't load the native purchase module.
Steps last checked against the SDK source on 15 Nov 2026.
What you'll build
- A React Native or Expo app that shows a dashboard-controlled paywall
- Content gated on the
premiumentitlement - A Restore Purchases button
What you'll need
- React Native, or Expo SDK 50+ with a development build (Expo Go is not supported)
- iOS 15+; the Android bridge uses your app's minSdk (24 if you don't set one)
- A free BillDog project (sign up)
- Products in the stores you sell through (App Store setup, Google Play setup)
1. Install the SDK and its native peers
3 minInstall the four native peer packages by name. Autolinking only sees packages in your app's own package.json, so they won't be linked if they're only dependencies of the SDK.
npm install @billdog.io/react-native@^1.2.0-beta.1 \
@react-native-async-storage/async-storage@^1.19.0 \
react-native-fs@^2.20.0 \
react-native-svg@^15.0.0 \
react-native-webview@^13.0.0
cd ios && pod installnpx expo install @billdog.io/expo@^1.2.0-beta.1 \
@billdog.io/react-native@^1.2.0-beta.1 \
@react-native-async-storage/async-storage \
react-native-fs \
react-native-svg \
react-native-webview \
expo-modules-coreIn Expo, leave the native peers unpinned so expo install picks versions that match your Expo SDK. The SDK accepts react-native-svg 13 to 15 and async-storage 1.19+ or 2.x. Bare React Native 0.75 and older: set platform :ios, '15.0' in ios/Podfile before running pod install.
On @billdog.io/expo 1.1.1-beta.5, install expo-modules-core yourself, as above, so your Expo SDK's version wins. Without it the iOS build fails on Expo 53.
2. Expo only: add the config plugin and build
5 minThe config plugin adds the native pod and raises the iOS deployment target. Then generate the native projects and run a development build.
{
"expo": {
"plugins": ["@billdog.io/expo"]
}
}npx expo prebuild
npx expo run:ios # or: npx expo run:android3. Set up the product, paywall and placement
12 minYour app asks BillDog for a placement (a named moment such as onboarding), and the dashboard decides which paywall to show there. That means you can change the paywall later without shipping an app update. Four things need to be connected: a product, an entitlement it grants, an offering that sells it, and a placement that serves the offering's paywall.
- Use the Public Sandbox API Key shown when you created the project. It starts with
bd_public_test_. Didn't save it? The API Keys list shows only a prefix, so make a new one: open Integration & Data → API Keys, click Generate API Key, enter a Key Name, choose Environment: Sandbox and Key Type: Public (Client), then copy the key from the dialog. It is shown only once. Ship only public keys in an app;bd_secret_keys are for servers. - Open Monetization → Products and click New Product. Keep Product Kind: Store. The Product Identifier is BillDog's own ID for the product. Set Product Type to Subscription and choose a Subscription Duration. Put the exact store IDs in App Store Product ID and Play Store Product ID. A product with no ID for a store is not served on that platform. Enable Web Checkout is on by default; its price is only used for Stripe on the web. Products not in the store yet? See App Store setup or Google Play setup.
- Open Monetization → Entitlements, click New Entitlement, use the identifier
premium(with any Display Name), and under Product Mapping tick the product. New projects also come with aproentitlement and a Default Offering; this codelab uses its own. Without this mapping a purchase succeeds but unlocks nothing. - Open Monetization → Offerings, click New Offering, give it an Identifier and Display Name, tick Mark as current offering and click Create Offering. The offering editor opens: click Add Product, tick your product, type a Package Identifier such as
monthly, click Add Package, then Save Changes. - Open Paywalls & Funnels → Create New → Single Paywall, choose Use Template and pick one. In the builder, open the Products panel (the box icon in the left rail) and choose your offering under Offering.
- Templates are designs: their buttons aren't wired to buy anything. Select the main button, and under Tap Actions click Add First Action and choose Purchase. Give the close button (or a secondary button) a Close Paywall action if it has none: publishing refuses a paywall with no way out.
- Click Publish (then Save & Publish). A warning that "nothing on this paywall starts a purchase" means the main button still has no Purchase action. Check the paywall shows Live under Paywalls & Funnels → All Paywalls. An unpublished paywall serves nothing.
- Open Monetization → Placements, click Create Placement, set the Identifier to
onboardingand a Display Name, and click Create. Then click the link icon on the placement's row, tick your offering, tick Default and click Link Offerings. - In the same Create Placement dialog (or later on the placement's page), turn on Requires access and choose
premiumas the Required Entitlement. Subscribers then skip the paywall instead of seeing it again.
Placement identifiers are case-sensitive. A mistyped identifier is created as an empty placement (you'll see it under Placements), and register comes back with a "no paywall configured" error. If nothing shows, see Fix a paywall that doesn't show.
4. Configure the SDK
2 minconfigure is on BillDogConfiguration, not on BillDog. Call it once at app start-up. Expo apps can import the same names from @billdog.io/expo.
import { BillDogConfiguration } from '@billdog.io/react-native'; // or '@billdog.io/expo'
BillDogConfiguration.configure({
apiKey: 'bd_public_test_YOUR_KEY',
enableLogging: __DEV__, // log what the SDK fetches while you develop
});5. Show the paywall for a placement
5 minBillDog.register never throws. It resolves with a result whose type tells you what happened.
import { BillDog } from '@billdog.io/react-native';
async function showPaywall() {
const result = await BillDog.register('onboarding');
switch (result.type) {
case 'entitled':
case 'purchased':
case 'restored':
setIsPro(true);
break;
case 'error':
console.warn('Placement failed', result.message);
break;
default:
break; // 'dismissed' | 'holdout' | 'withheld' | 'oauthSuccess'
}
}6. Unlock content with the entitlement
3 minasync function refreshAccess() {
try {
const info = await BillDog.getCustomerInfo(); // CustomerInfo | null
setIsPro(!!info?.entitlements.some((e) => e.identifier === 'premium' && e.isActive));
} catch (e) {
console.warn('Could not read entitlements', e);
setIsPro(false); // treat errors as locked
}
}getCustomerInfo throws when the native read fails, and can resolve to null when nothing is known yet. Treat both as locked.
7. Add Restore Purchases
2 minIn React Native the method is BillDog.restore(), not restorePurchases. It resolves with a result rather than throwing. Afterwards, read customer info with 'FETCH_CURRENT' so the cache is skipped.
const r = await BillDog.restore();
if (r.type === 'restored') console.log(`Restored ${r.items.length}`);
else console.warn('Restore failed', r.error);
// Refresh access so the UI shows the restored state
const info = await BillDog.getCustomerInfo('FETCH_CURRENT');
setIsPro(!!info?.entitlements.some((e) => e.identifier === 'premium' && e.isActive));Before release, switch to your bd_public_live_ key. To buy in the store sandboxes, see iOS sandbox testing and Google Play testing.