RevenueCat Integration
Configure RevenueCat webhooks for automatic commission tracking
Why RevenueCat?
RevenueCat handles subscription complexity (trials, renewals, refunds, platform differences). InfluTo integrates via webhooks to automatically track which subscriptions came from which influencers.
Benefits
- ✓ Automatic attribution via subscriber attributes
- ✓ Handles iOS and Android subscriptions
- ✓ Tracks trials, renewals, cancellations, refunds
- ✓ No manual webhook code needed
Step 1: Create RevenueCat Account
- Go to app.revenuecat.com/signup
- Create account (free tier available)
- Create a new project
- Add your app (iOS and/or Android)
Step 2: Install RevenueCat SDK
React Native
npm install react-native-purchases
# or
yarn add react-native-purchases
# iOS
cd ios && pod install && cd ..Initialize RevenueCat
import Purchases from 'react-native-purchases';
Purchases.configure({
apiKey: Platform.OS === 'ios'
? 'rcpk_ios_abc123...' // From RevenueCat dashboard
: 'rcpk_android_xyz789...'
});
// IMPORTANT: Do this BEFORE InfluTo.initialize()Step 3: Configure Webhook in RevenueCat
Get Your Webhook URL
- Go to InfluTo Dashboard → Your App → Settings
- Copy webhook URL:
https://influ.to/api/webhooks/revenuecat - Copy webhook secret (shown once)
Add Webhook in RevenueCat
- RevenueCat Dashboard → Integrations → Webhooks
- Click "+ New"
- Enter webhook URL:
https://influ.to/api/webhooks/revenuecat - Enter authorization:
Bearer rc_webhook_...(your webhook secret)
Enable Events
Check these event types:
- ✓
INITIAL_PURCHASE- First subscription - ✓
RENEWAL- Recurring payments - ✓
CANCELLATION- User cancels - ✓
PRODUCT_CHANGE- Plan changes - ✓
BILLING_ISSUE- Payment failures - ✓
EXPIRATION- Subscription expires
💡 Pro Tip
Enable all event types. InfluTo automatically handles each type correctly and calculates recurring commissions on renewals.
Step 4: Test Webhook
Send Test Event
- RevenueCat Dashboard → Integrations → Webhooks
- Click your webhook
- Click "Send Test Event"
- Select
INITIAL_PURCHASE - Click Send
Verify in InfluTo
- InfluTo Dashboard → Analytics → Recent Events
- Should see test event logged
- Status: Processed or Error (with message)
How Attribution Works
The Flow
1. User clicks influencer link
→ InfluTo stores click with device fingerprint
2. User installs app and opens it
→ SDK.checkAttribution() matches device to click
→ SDK gets referral code: "FITGURU30"
3. SDK automatically calls RevenueCat:
→ Purchases.setAttributes({ referral_code: "FITGURU30" })
4. User purchases subscription
→ RevenueCat transaction completes
5. RevenueCat webhook fires to InfluTo:
POST https://influ.to/api/webhooks/revenuecat
{
"event": {
"app_user_id": "user_123",
"product_id": "premium_monthly",
"price": 9.99,
"subscriber_attributes": {
"referral_code": {
"value": "FITGURU30" ← SDK set this!
}
}
}
}
6. InfluTo receives webhook:
→ Finds campaign for "FITGURU30"
→ Calculates commission: $9.99 × 30% = $2.997
→ Credits influencer's balance
→ Updates analytics
7. Month-end: Automatic payout
→ Influencer receives $2.997 in their bank accountSubscriber Attributes
What They Are
RevenueCat subscriber attributes are key-value pairs attached to each user. They're included in every webhook, allowing attribution.
Setting Attributes
// InfluTo SDK does this automatically:
await Purchases.setAttributes({
referral_code: 'FITGURU30'
});
// But you can also set manually:
await Purchases.setAttributes({
referral_code: userEnteredCode,
source: 'influencer',
campaign: 'launch'
});Viewing Attributes
const customerInfo = await Purchases.getCustomerInfo();
console.log(customerInfo.entitlements.all);
// You'll see:
// {
// referral_code: "FITGURU30",
// source: "influencer"
// }Webhook Payload Structure
INITIAL_PURCHASE
{
"event": {
"event_timestamp_ms": 1658726378679,
"product_id": "premium_monthly",
"period_type": "NORMAL",
"purchased_at_ms": 1658726374000,
"expiration_at_ms": 1659331174000,
"environment": "PRODUCTION",
"app_user_id": "user_123",
"price": 9.99,
"price_in_purchased_currency": 9.99,
"currency": "USD",
"subscriber_attributes": {
"referral_code": {
"value": "FITGURU30",
"updated_at_ms": 1658726370000
}
},
"store": "APP_STORE"
},
"type": "INITIAL_PURCHASE",
"api_version": "1.0"
}RENEWAL
{
"event": {
"event_timestamp_ms": 1661404778679,
"product_id": "premium_monthly",
"period_type": "NORMAL",
"app_user_id": "user_123",
"price": 9.99,
"original_transaction_id": "original_txn_123"
},
"type": "RENEWAL"
}✓ Recurring Commissions
RENEWAL events automatically credit recurring commission to the influencer. No additional code needed - InfluTo handles it automatically.
Testing Webhooks
Sandbox Mode
- Use RevenueCat sandbox environment
- Make test purchase with sandbox account
- Webhook fires with
"environment": "SANDBOX" - InfluTo logs but doesn't create production commission
Test Purchase Flow
// 1. Set test code
await Purchases.setAttributes({ referral_code: 'TESTCODE' });
// 2. Make sandbox purchase
const offering = await Purchases.getOfferings();
await Purchases.purchasePackage(offering.current.availablePackages[0]);
// 3. Check InfluTo dashboard
// Should see: SANDBOX event logged with TESTCODETroubleshooting
Webhook Not Firing
- Check webhook is enabled in RevenueCat
- Verify URL is correct
- Check authorization header matches secret
- Look at RevenueCat webhook logs
Attribution Not Working
- Verify
referral_codeis in subscriber attributes - Check code exists in InfluTo dashboard
- Verify campaign is active
- Check InfluTo webhook logs for errors
Commission Not Calculated
- Check webhook secret is correct
- Verify environment (PRODUCTION vs SANDBOX)
- Check wallet has sufficient balance
- Look for processing errors in dashboard
Advanced Configuration
Multiple Apps
Each app needs its own webhook configuration:
App 1: https://influ.to/api/webhooks/revenuecat/app_id_1
App 2: https://influ.to/api/webhooks/revenuecat/app_id_2Webhook Retries
- RevenueCat retries failed webhooks automatically
- Exponential backoff: 1min, 5min, 30min, 2hr, 8hr
- InfluTo handles duplicates via idempotency