RevenueCat
If you are using RevenueCat instead of raw StoreKit, the process is very similar but uses subscriber_attributes or appUserID instead of appAccountToken.
Step 1: Generate & persist a stable Install ID
Section titled “Step 1: Generate & persist a stable Install ID”Generate a unique ID (UUID) the first time the app is opened and store it permanently on the device.
import AsyncStorage from '@react-native-async-storage/async-storage';import { v4 as uuidv4 } from 'uuid';
const INSTALL_KEY = 'biteasy_install_id';
export async function getStableInstallId() { let id = await AsyncStorage.getItem(INSTALL_KEY);
if (!id) { id = uuidv4(); await AsyncStorage.setItem(INSTALL_KEY, id); }
return id;}- Stored once via AsyncStorage
- Survives restarts; clears only if user manually wipes data or uninstalls
- No regeneration ensures deterministic attribution
Step 2: Use Install ID during Claim
Section titled “Step 2: Use Install ID during Claim”BitEasy learns the install ID the first time a user claims a referral code:
await fetch('https://api.biteasy.com/api/v1/claim', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ appId, installId: await getStableInstallId(), code, }),});Note: This is just an example. You may also pass
installIdwhen using the JS SDK.
Step 3: Configure RevenueCat
Section titled “Step 3: Configure RevenueCat”Pass the installId to RevenueCat so it is included in webhooks.
import Purchases from 'react-native-purchases';
// Option A: Set as custom attribute (RECOMMENDED)await Purchases.setAttributes({ biteasyInstallId: await getStableInstallId(),});or:
// Option B: Set as App User IDPurchases.configure({ apiKey: RC_API_KEY, appUserID: await getStableInstallId(),});Important: The custom attribute
biteasyInstallIdtakes precedence overappUserID.
Webhook Flow
Section titled “Webhook Flow”- User claims referral → BitEasy stores
installId. - User buys → RevenueCat verifies → Webhook fires.
- Webhook includes
appUserID(which matchesinstallId). - BitEasy matches the IDs to attribute the sale.
That’s it! BitEasy will automatically attribute the purchase to the install ID.