# Give referred users a better offer

> Show people who came through a creator a different paywall, a longer trial or a discount — gated in your app or with RevenueCat Targeting.

Creators sell your app more easily when their audience gets something for using their link or code: a longer free trial, a first-month discount, a better yearly price. InfluTo tells your app whether the user was referred; what you offer them is up to you and is set up in your own paywall, in RevenueCat, or in the stores.

There are two ways to decide who sees the offer: check `checkAttribution()` in your app, which works with any purchase path, or let RevenueCat Targeting pick the offering from a subscriber attribute the SDK sets.

## Know whether the user was referred

`checkAttribution()` returns `attributed: true` when InfluTo connected the install to a creator — through link-click matching, a link that carried the code into the app, or a code the user typed into your app. The result is stored on the device, so later calls are instant. Call it before you show the paywall, and again after your code field if the user entered a code there.

<!-- tabs -->
```tsx title="React Native / Expo"
const attribution = await InfluTo.checkAttribution();
const paywall = attribution.attributed ? 'referral' : 'standard';
```
```swift title="iOS (Swift)"
let attribution = await InfluTo.checkAttribution()
let paywall = attribution.attributed ? "referral" : "standard"
```
```kotlin title="Android (Kotlin)"
val attribution = InfluTo.checkAttribution() // suspend
val paywall = if (attribution.attributed) "referral" else "standard"
```
```dart title="Flutter (Dart)"
final attribution = await InfluTo.instance.checkAttribution();
final paywall = attribution.attributed ? 'referral' : 'standard';
```
```ts title="Web / Capacitor / PWA"
const attribution = await InfluTo.checkAttribution();
const paywall = attribution.attributed ? 'referral' : 'standard';
```
<!-- /tabs -->

`attribution.referralCode` tells you which creator, if you want a creator-specific deal.

> [!NOTE]
> A free-access code typed into the code field also marks the user as referred — on the device, and in RevenueCat's `influto_referral` when the SDK writes RevenueCat attributes. Those users usually have premium already and skip the paywall; if not, check the code type when it's applied (see [Creator access codes](https://docs.influ.to/platform/creator-access-codes.md)).

## Option 1: Gate the offer in your app

This works with RevenueCat and store-direct alike. Create the better offer as its own product (or offering) in your store setup — for example a yearly plan with a 14-day trial instead of 7 — and show it when `attributed` is true. Purchases of that product are verified and credited to the creator like any other.

## Option 2: RevenueCat Targeting on `influto_referral`

When the SDK attributes a user, it also writes two RevenueCat subscriber attributes: `influto_code` (the creator's code) and `influto_referral` (the string `"true"`). InfluTo itself only reads `influto_code`; `influto_referral` exists so you can target referred users in RevenueCat.

<!-- steps -->

### Make sure the SDK writes the attributes

React Native does it automatically when `react-native-purchases` is installed, and Android finds the RevenueCat SDK automatically (or takes an explicit setter). iOS needs `revenueCatAttributeSetter`, Flutter `revenueCatHook`, and web a `revenueCat` binding. See the RevenueCat section of your SDK page: [React Native](https://docs.influ.to/sdk/react-native.md#revenuecat) · [iOS](https://docs.influ.to/sdk/ios.md#revenuecat) · [Android](https://docs.influ.to/sdk/android.md#revenuecat) · [Flutter](https://docs.influ.to/sdk/flutter.md#revenuecat) · [Web](https://docs.influ.to/sdk/web.md#revenuecat).

### Create the referral offering in RevenueCat

Add an offering with the better packages — for example products with a longer trial or an introductory price.

### Add a Targeting rule

In RevenueCat's **Targeting**, create a rule with a **Custom attributes** condition: `influto_referral` is `true`. Serve the referral offering, and place the rule above the one that serves everyone else. RevenueCat compares attribute values as strings, which matches the `"true"` the SDK writes. To give one creator's audience their own deal, target `influto_code` instead, with that creator's code as the value.

### Sync attributes before fetching offerings

RevenueCat normally sends attributes to its servers when the app starts, goes to the background, or makes a purchase. Right after attribution, call RevenueCat's `syncAttributesAndOfferingsIfNeeded()` and show the offering it returns (`current`), so the rule applies in the same session. RevenueCat limits this call to five per minute.

<!-- /steps -->

Your paywall must display RevenueCat's current offering, not a hard-coded one, for Targeting to have any effect. RevenueCat's own documentation is the reference for Targeting and for which conditions its Experiments support: [Targeting](https://www.revenuecat.com/docs/tools/targeting) · [Customer attributes](https://www.revenuecat.com/docs/customers/customer-attributes).

## Store-direct apps

Without RevenueCat, use Option 1: check `checkAttribution()` and show your referral paywall with the better product. Both stores also have their own discount tools — for example App Store offer codes and promotional offers, and Google Play subscription offers with developer-determined eligibility. Each has its own eligibility rules, so check Apple's and Google's documentation before relying on one. InfluTo captures and verifies these purchases the same way as any other — see [Store-direct](https://docs.influ.to/integrations/store-direct.md).

## What a discount does to the commission

Commission is a percentage of what the user actually pays, in USD. A 50% first-month discount halves the creator's commission on that payment, and a longer trial delays the first commission until the trial converts. Renewals at the full price earn the full rate. If you want creators to keep their full first commission, a longer trial is usually the friendlier choice. See [Commissions and fees](https://docs.influ.to/platform/commissions.md).

## Keep it within store rules

- Make the offer a better price or a longer trial for your subscription, paid through the store's own billing.
- Don't pay or reward people for installing the app, or for ratings and reviews. Both stores restrict incentivized installs and reviews — check the App Store Review Guidelines and the Google Play Developer Program Policies before launching any promotion.
- Describe the offer accurately on your paywall, and make sure creators describe it the same way.

## Test it

<!-- steps -->

### Attribute a test install

Enter a test creator's code in your code field on a sandbox build, or install through their link. `checkAttribution()` should return `attributed: true`.

### Check the attributes in RevenueCat

Open the sandbox customer in RevenueCat and confirm `influto_code` and `influto_referral` are set.

### Confirm the paywall

After `syncAttributesAndOfferingsIfNeeded()`, the paywall should show the referral offering. Make a sandbox purchase and watch it arrive in **Real-Time Events** — see [Verify the integration](https://docs.influ.to/integrations/testing.md).

<!-- /steps -->

## Next

<!-- cards -->
- [Let users enter a referral code](https://docs.influ.to/guides/referral-codes.md) — More referred users means more people who see the offer.
- [RevenueCat setup](https://docs.influ.to/integrations/revenuecat.md) — Connect the webhook that credits these purchases.
<!-- /cards -->
