Skip to content

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

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 installId when using the JS SDK.


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 ID
Purchases.configure({
apiKey: RC_API_KEY,
appUserID: await getStableInstallId(),
});

Important: The custom attribute biteasyInstallId takes precedence over appUserID.


  1. User claims referral → BitEasy stores installId.
  2. User buys → RevenueCat verifies → Webhook fires.
  3. Webhook includes appUserID (which matches installId).
  4. BitEasy matches the IDs to attribute the sale.

That’s it! BitEasy will automatically attribute the purchase to the install ID.