Buraq.

By · · 7 min read

How to Build a Referral System in React Native: Deep Links, Rewards, and Attribution

A referral system is the highest-ROI marketing investment for a mobile app. Here's how to build one in React Native — deep links, Play Store Install Referrer, stacking rewards, and the gotchas that trip up most implementations.

A referral system is the closest thing to a growth engine that a solo developer or small team can build in a weekend. Users acquired through referrals have 37% higher retention and 16% higher lifetime value than users from paid channels — and those are the averages; the best referral programs pull even further ahead. (Source: ReferralCandy, Referral Marketing Benchmarks.) The hard part isn't the concept — it's getting the implementation right across the three completely different paths a person might take when they receive a referral link.

The three capture sources you need, not one

Most referral system tutorials cover one path: the deep link that opens the app directly. In reality, a mobile referral needs to work across three separate scenarios, and each requires a different mechanism. Miss one, and a meaningful share of your referral traffic simply disappears — no error, no signal, just a link that went nowhere.

The first path is the web redirect. Someone without the app clicks a referral link from their browser. The link hits a landing page (or a server-side redirect) that sends them to the Play Store or App Store with the referral code embedded in the URL as a referrer parameter. This is the simplest path to implement and the most common entry point. The second path is the direct deep link. If the app is already installed, the referral link should open the app directly with the code already parsed — no intermediate web page, no App Store redirect. The third and most commonly neglected path is the delayed install. Someone clicks a Play Store link and browses the store page, but installs the app later — sometimes hours or days afterward. This requires the Play Store Install Referrer API, which stores the referrer string even across a delayed install.

Setting up deep links that actually work

Android App Links are the standard approach for direct app opening on Android. The setup involves an intent filter in AndroidManifest.xml that declares your app can handle URLs matching a specific pattern (e.g., https://yourapp.com/invite/CODE), and an assetlinks.json file hosted at the root of your domain that proves you control both the app and the domain. This is where most implementations break silently. The SHA-256 fingerprint in assetlinks.json must match the exact signing key used to sign your app — and the debug key differs from the production key. If you're testing with a debug build and deploying with a production build, you need two entries in assetlinks.json, or the production build will silently fail to open from links.

On the React Native side, React Navigation's linking configuration handles parsing the URL and navigating to the correct screen. Configure prefixes for both your custom scheme and your HTTPS domain, map the path pattern to a screen, and extract the code parameter from the route params. Test this end to end — from an actual link click on a physical device — before calling it done. Simulators and emulators do not reliably reproduce the real app link verification flow.

The Play Store Install Referrer: your most reliable capture path

The Play Store Install Referrer API is the most underused piece of the referral puzzle. When someone clicks a Play Store URL that contains a referrer parameter, Android stores that referrer string in the Play Store's own database. Even if the user closes the Play Store and installs the app three days later from a search, the referrer string is available on first launch. The react-native-play-install-referrer library wraps this API and makes it straightforward: import the getInstallReferrer function, call it on app launch (ideally only the first launch after install, so you don't re-trigger referral attribution), and check the installReferrer field for the referral code.

The referrer is retained for 90 days after the initial click, so you have a wide window to capture it. On iOS, the equivalent is Apple's AdServices API, which provides install attribution but with a shorter retention window and a different implementation path. If your app is cross-platform, budget separate effort for each platform's attribution mechanism — they share no code.

Stacking rewards: the pattern that drives repeat referrals

Most referral programs offer a single, one-time reward. "Refer a friend, get a free month." That works for the first referral but provides no marginal incentive for the second, third, or tenth. Stacking rewards fix this: each referral adds a reward to a queue, activated sequentially as previous rewards expire. Ten referrals means ten free months, queued one after another. The incentive is constant per referral rather than declining.

The server-side implementation tracks rewards in a separate table with status fields: pending, active, exhausted, expired. When a referral is validated, the backend checks whether the referrer already has an active or queued reward. If they do, the new reward's start date is set to the end date of the last queued reward. Otherwise, it starts immediately. A cron job (or webhook handler) manages the transition when an active reward expires and the next one should start. If you use RevenueCat for subscription management, promotional entitlements via their REST API handle the grant, but the queue management must live in your backend — RevenueCat manages only the active entitlement state, not a queue of future ones.

Anti-fraud: what you need before launching

A referral system without guardrails will be abused. The minimum protections: require email verification before a referral reward is granted (one email can reward one referrer), implement rate limiting on referral submissions (e.g., max 5 referrals per hour per account), and validate on the backend that the referral code is valid and hasn't been used by this person before. Client-side validation is not enough — a malicious user can manipulate any client-side check. Every granting decision must happen server-side, and the reward must be applied only after the referred user performs a qualifying action (signs up, completes onboarding, or makes a first purchase depending on your business model).

The invite experience that converts

The technical plumbing is necessary but not sufficient. The actual sharing experience determines whether your referral system generates growth or sits unused. Use the built-in React Native Share API so users can share via any channel they already use (WhatsApp, SMS, email, messaging apps). The share should include a clear, benefit-first message: what the recipient gets (not just what the referrer gets). Include the deep link that captures the referrer code. Show the user their own referral stats within the app — how many people have signed up, how many rewards they've earned, how many are pending. Visibility into the reward queue is itself a conversion driver: seeing four free months queued up is more motivating than a vague "you earned rewards."

A referral system built on solid technical foundations — covering all three capture paths, with stacked rewards and basic fraud protection — can become the primary acquisition channel for a mobile app. It costs a weekend to build and continues generating installs without ongoing ad spend. That math is hard to beat for any solo developer or small team.