Quickstart: paid features in an Expo app

On this page

You don't need to write any server code for this, and you don't deploy anything to Tenth.

1. Create the app in the dashboard

  1. Apps → New app. Add an iOS platform (bundle ID), an Android platform (package name) and, if you sell on the web, a web platform.
  2. Connections.

    • App Store: add your App Store Connect API key and in-app purchase key.
    • Google Play: add your Play service account key.
    • Stripe: connect your account.

    Each connection runs a setup check before it's saved. Then point the stores' notifications at Tenth: see Store notifications.

  3. Catalog. Import your store products and map them to an entitlement such as pro. Then put them in the default offering. Prices always come from the store or Stripe, so you never type them into Tenth.
  4. Keys. Copy the publishable key (tenth_test_pk_...). Secret keys stay on your server; the SDK refuses them.
  5. Identity. If your app signs users in with Clerk or another OIDC provider, set it up here so Tenth can verify their tokens. Without a provider, your server can mint customer tokens instead. Customer identity covers both.
  6. Settings → Web, only if you sell on the web:

    • add your site's origin to Web origins;
    • add the same origin to Stripe redirect origins;
    • for apps that send buyers to hosted Checkout, set your app's URL scheme.

2. Add the SDK

Terminal
npx expo install @tenthbilling/expo expo-secure-store expo-crypto expo-constants expo-web-browser lucide-react-native react-native-svg

Then add the config plugin to app.json:

JSON
{
  "expo": {
    "scheme": "myapp",
    "plugins": [["@tenthbilling/expo", { "googlePlayBilling": true }]]
  }
}

Purchases need a development build: eas build --profile development, or a local build with npx expo run:ios or npx expo run:android (both run the config plugin through a prebuild). In Expo Go the SDK runs in preview mode: a mock store with test prices, so you can build the paywall and gating before your first native build.

3. Write the code

TSX
import { TenthProvider, Paywall, useEntitlement } from '@tenthbilling/expo';
import { useAuth } from '@clerk/clerk-expo';

export default function App() {
  const { getToken } = useAuth();
  return (
    <TenthProvider apiKey="tenth_test_pk_..." getCustomerToken={getToken}>
      <Home />
    </TenthProvider>
  );
}

function Home() {
  const pro = useEntitlement('pro');
  if (!pro.active) return <Paywall />; // default offering, remote-configured
  return <ProFeature />;
}

getCustomerToken is optional. Before the user signs in, the SDK uses an anonymous customer for the device, and it moves that customer's purchases to the signed-in user on the first call with a token.

The SDK takes care of the rest:

  • Store routing: StoreKit on iOS, Play Billing on Android, and Stripe's payment form on the web. The offering's purchase path can change this.
  • Verification: Tenth checks every purchase on the server before it grants access.
  • Offline access: cached access stays available offline for up to 72 hours, and never past its expiry.
  • Refreshing: state refreshes on launch, when the app returns to the foreground, and after every purchase.

4. Change the paywall without an app release

In the dashboard, open Paywalls. Choose a template (hero, tiers, comparison or credits), then edit the copy, colors, font, image and legal links, and publish. Apps pick up the change the next time they load the offering. The SDK keeps a loaded offering for up to 5 minutes.

Going further

You wantUse
A different offering<Paywall offering="black_friday" />
A sheet or modal<Paywall presentation="sheet" onDismiss={...} /> or presentPaywall()
Your own product cards<Paywall slots={{ productCard: MyCard }} />, where MyCard gets { product, selected, select }
A fully custom paywallusePaywall(): products with store prices, purchase(), restore()
Gating a screen<Gate entitlement="pro" fallback={<Paywall />}>...</Gate>
CreditsuseCredits('ai_credits') for the balance; spend from your server with @tenthbilling/node
Card payments inside a native appimport '@tenthbilling/expo/payment-sheet' (needs @stripe/stripe-react-native)

The Expo SDK reference covers each of these.

Check access on your server too. The device's view of access is fine for showing and hiding UI. Anything that must not be bypassed, like generating content or spending credits, should be checked on your server with @tenthbilling/node.