Customizing for Production
Going from the mock to a shipping integration is mostly about replacing the stand-ins with the real thing.
1. Wire your real billing
You pass a purchase function to useEncoreCallbacks. In the mock it’s a fake
~1.2s delay; in production it’s your billing library — Encore never charges; your
billing does.
RevenueCat:
useEncoreCallbacks(Encore, {
purchase: async (productId) => {
const products = await Purchases.getProducts([productId]);
const { transaction } = await Purchases.purchaseStoreProduct(products[0]);
return { transactionId: transaction.transactionIdentifier };
},
onResume: (placementId) => resumeOriginalAction(placementId),
});react-native-iap:
purchase: async (productId) => {
const purchase = await requestPurchase({ sku: productId });
await finishTransaction({ purchase });
return { transactionId: purchase.transactionId };
},useEncoreCallbacks already calls completePurchaseRequest(true/false) on both
paths — you don’t touch that.
2. Use real placement IDs from the dashboard
Create the real placements in the Encore dashboard and reference them through your
Placements constant:
export const Placements = {
CancellationFlow: 'your_real_cancellation_placement_id',
FeaturePaywall: 'your_real_paywall_placement_id',
};Because call sites use Placements.* (never raw strings), this is the only edit
needed. In live mode the offer content and partner catalog come from the
dashboard — the offers you pass to createMockEncore are mock-only.
3. Switch to the real SDK
export const ENCORE_API_KEY = 'pk_live_…';
export const USE_MOCK = false;Install @tryencorekit/react-native and rebuild the native app / dev client. TS
types come from the real package automatically — no shim to remove. See
Mock vs Live Mode.
4. Turn down logging
Drop logLevel from "debug" to "error" on the provider, and route any
console.logs through your app’s logger.
5. Own entitlement state for real
In production, derive entitlement from your billing provider + backend (e.g.
RevenueCat customerInfo.entitlements), not local state, so it survives reinstalls
and syncs across devices. Keep updating it from placement().show() results and
onPurchaseComplete.
Production checklist
- Real billing wired into the
purchasefn -
completePurchaseRequest(true/false)on every path (handled byuseEncoreCallbacks) - Real
pk_key +USE_MOCK = false -
@tryencorekit/react-nativeinstalled; native app / dev client rebuilt - Real placement IDs in
encoreConfig.js -
logLevellowered; debug logs removed - Entitlement state sourced from billing/backend, not local state