Docs

Handling purchases

Wire Onvert paywall CTAs to your existing StoreKit or Play Billing path.

Onvert does not replace your billing stack. When a user taps a plan on a paywall, the SDK calls your onPurchase handler with a product identifier you configured in the dashboard.

Recommended pattern

  1. Map dashboard product IDs to App Store / Play product IDs one-to-one
  2. Start the store purchase inside onPurchase
  3. On success, unlock entitlements in your app and let the flow continue / complete
  4. On failure or cancel, keep the paywall visible so the user can retry
tsx
onPurchase={async (productId) => {
  const result = await iap.purchase(productId);
  if (!result.ok) throw new Error(result.message);
}}
Throwing or rejecting from onPurchase signals a failed purchase so the SDK can keep the paywall open.