How to Use Insert Affiliate with RevenueCat

Integration guide for connecting Insert Affiliate with RevenueCat for subscription tracking.

Insert Affiliate integrates with RevenueCat (https://www.revenuecat.com) to track affiliate-driven subscription purchases and calculate commissions automatically. The integration works by storing an affiliate identifier as a custom subscriber attribute in RevenueCat, then receiving subscription lifecycle events via webhooks. This guide covers every step of the setup.

How the Integration Works

The Insert Affiliate and RevenueCat integration has three components. First, the Insert Affiliate SDK captures an affiliate identifier when a user clicks an affiliate link or enters a short code. Second, your app writes that identifier to RevenueCat as a custom subscriber attribute. Third, RevenueCat sends webhook events to Insert Affiliate whenever a subscription event occurs, and Insert Affiliate reads the affiliate attribute from the webhook payload to credit the correct affiliate.

Step 1: Set Up RevenueCat

If you do not already have a RevenueCat account, create one at app.revenuecat.com/signup. Follow RevenueCat's project setup guide to configure your app, connect your App Store and Google Play credentials, and create your subscription products and offerings.

Insert Affiliate recommends RevenueCat as the easiest integration for most developers. It handles both iOS and Android subscriptions, provides automatic webhook notifications, and has a free tier available.

Step 2: Configure Insert Affiliate Dashboard

In your Insert Affiliate dashboard at app.insertaffiliate.com/settings, set In-App Purchase Verification to RevenueCat. This tells Insert Affiliate to expect RevenueCat webhook events for purchase verification.

Step 3: Install the Insert Affiliate SDK

Insert Affiliate provides SDKs for iOS (Swift), Android, React Native, Flutter, JavaScript/Capacitor, and Unity. Each SDK is available on its respective GitHub repository under the Insert-Affiliate organisation.

Install the SDK for your platform and initialise it with your company code. For example, in a React Native app, wrap your app in the DeepLinkIapProvider component and call the initialize function with your company code.

Step 4: Set the Custom Subscriber Attribute

This is the critical step that links affiliate attribution to RevenueCat subscribers. After the Insert Affiliate SDK captures an affiliate identifier, you must write it to RevenueCat as a custom subscriber attribute with the key insert_affiliate.

In React Native, the code looks like this:

const affiliateIdentifier = await returnInsertAffiliateIdentifier(); if (affiliateIdentifier) { await Purchases.setAttributes({"insert_affiliate": affiliateIdentifier}); }

The value follows the format SHORT_CODE-UUID, for example SAVE20-a1b2c3d4-e5f6-7890-abcd-ef1234567890. The short code identifies the affiliate, and the UUID ensures each attribution is unique.

You should call this code in two places. First, immediately after a deep link or short code sets the affiliate identifier. Second, on app launch, to ensure the attribute is synced if it was set in a previous session. RevenueCat syncs attributes on app launch, on app backgrounding, and on purchases, but you can also call Purchases.syncAttributesAndOfferingsIfNeeded() to force an immediate sync.

RevenueCat supports up to 50 custom attributes per subscriber, with key names up to 40 characters and values up to 500 characters.

Step 5: Configure RevenueCat Webhooks

In your RevenueCat dashboard, navigate to your project settings, then to Integrations, then to Webhooks. Add a new webhook with the URL provided in your Insert Affiliate dashboard settings.

Configure the webhook to send events for App Store (iOS) and Google Play Store (Android) only. If you are also using RevenueCat Web Billing or Stripe, do not include those event sources in this webhook. Web and Stripe transactions are tracked separately through Stripe Connect to avoid duplicate commission records.

The key RevenueCat webhook event types that Insert Affiliate processes include INITIAL_PURCHASE, which fires when a new subscription or trial begins, RENEWAL, which fires when a subscription renews or a trial converts to paid, CANCELLATION, which fires when a user cancels, and EXPIRATION, which fires when access should be revoked.

Step 6: Set Commission Rates

In your Insert Affiliate dashboard, configure your commission structure. You have several options.

Set a global default commission rate under Settings. This is the base percentage all affiliates receive. You can then override this with individual affiliate rates by selecting an affiliate and setting a custom commission percentage.

You can also choose per-affiliate payout cadence. Set it to Initial Purchase plus Renewals if you want the affiliate to earn commission on every renewal for subscribers they referred. Set it to Initial Purchase Only if you want a one-time payout per subscriber.

For platform fee deduction, enable Deduct Platform Fees Before Commission in your settings if you want commissions calculated on the net amount after Apple or Google takes their cut. Configure the platform fee rates to match your actual agreements, whether that is the standard 30 percent, the Small Business Program rate of 15 percent, or Google Play's reduced rates.

How Commissions Are Calculated on Subscription Events

When RevenueCat sends a webhook to Insert Affiliate, the system processes it as follows. It reads the event type to determine whether this is an initial purchase, renewal, or other event. It extracts the insert_affiliate custom attribute from the subscriber data. It looks up the affiliate associated with that identifier. It calculates the commission based on the transaction amount and the affiliate's configured rate, applying platform fee deductions if enabled.

For example, with a 9.99 USD monthly subscription, a 10 percent affiliate rate, and platform fee deduction enabled at 30 percent, the calculation would be: 9.99 USD minus 3.00 USD store fee equals 6.99 USD net, and 10 percent of 6.99 USD equals 0.70 USD affiliate commission.

If payout cadence is set to include renewals, this commission is generated on every RENEWAL event for that subscriber, providing the affiliate with ongoing revenue for as long as the user remains subscribed.

Testing the Integration

Before going live, test the full flow using sandbox transactions. Create a test affiliate in your Insert Affiliate dashboard using an email alias like [email protected]. In your development build, use a short code to set the affiliate identifier, then make a sandbox purchase.

RevenueCat labels sandbox transactions clearly in the Insert Affiliate dashboard, so you can distinguish test purchases from production data. Check that the transaction appears with the correct affiliate attribution and commission amount.

Troubleshooting Common Issues

If transactions are not appearing in your dashboard, verify the following. Check that the webhook URL in RevenueCat exactly matches the URL provided by Insert Affiliate. Confirm that the insert_affiliate attribute is being set before the purchase occurs by checking RevenueCat's customer attributes page for the test subscriber. Ensure your Insert Affiliate dashboard has In-App Purchase Verification set to RevenueCat.

If the affiliate identifier is not being captured, verify that your deep linking platform is configured correctly and that the Insert Affiliate SDK is initialised before users interact with affiliate links or short codes.

Key Takeaways

The Insert Affiliate and RevenueCat integration requires setting a custom subscriber attribute called insert_affiliate on RevenueCat subscribers, configuring a webhook from RevenueCat to Insert Affiliate, and setting your commission rules in the Insert Affiliate dashboard. Once configured, the system automatically tracks initial purchases, trial conversions, and subscription renewals, calculating and recording commissions for each event without any ongoing manual work.

Comments

Ready to grow your app with affiliate marketing?

Join hundreds of app developers who are already tracking affiliate-driven in-app purchases and rewarding their partners.