Skip to main content
Documentation
GuidesReferrals

Flutter referral quickstart

Add referrals to a Flutter app: install SDK 1.2.0, redeem the invitation, call claimReferral, handle each status, and get a signed webhook.

A referral in Flutter takes two calls on WarpLink: redeemInvitation(text) reads the invitation an iPhone user pastes, and claimReferral(installerId) credits the install when the person signs up. On Android, the Play install referrer carries the invitation and the SDK matches it with no call of yours. This quickstart covers both platforms, then the webhook that tells your backend to grant the reward.

For the whole path, including the dashboard setup, read the referrals guide.

What you need

  • An app registered in WarpLink: its App Store URL for iOS, and its package name and signing certificate SHA256 fingerprint for Android.
  • An SDK key from Keys, then SDK keys. If your organization has several apps, create the key for this app.
  • Flutter 3.38 or later and Dart 3.10 or later. The plugin runs on iOS and Android.
  • A webhook endpoint, added under Referral handoff, then Webhook. See Receive referral webhooks.

Install SDK 1.2.0

This adds warplink_flutter: ^1.2.0 to pubspec.yaml. SDK 1.1.x cannot read an invitation. Call WarpLink.configure once from your root widget's initState, as shown in the Flutter SDK setup.

Open a link in the dashboard and turn on Referral link, or send is_referral over REST:

Store the returned link id with the user who shares it. The webhook names that link, and the id tells you whose invitation earned the credit. Create referral links covers converting existing links in bulk.

Read the invitation

Android: Google Play hands the install referrer to the SDK at first launch, and the invitation rides inside it. The match is exact (android_referrer) and needs no screen of yours.

iPhone: the install carries no data, so your first screen offers a field where the person pastes the invitation. Pass the text to redeemInvitation:

The package has no paste-button widget. The SDK never reads the clipboard, and it sees only the text you pass in. Keep a skip option: the paste step is an offer, not a gate, and onboarding continues when it returns null or throws.

After a WarpLinkNetworkException the native SDK keeps the invitation and tries again on a later launch. That later result arrives through getAttributionResult() and claimReferral, not through onLink.

Claim the install

When the friend signs up, call claimReferral with an installer id: a dedicated random id for the new user, 1 to 128 characters. Do not use a primary key, an email address or a phone number.

claimReferral is safe to repeat. The first valid claim for an app and installer id wins, and the same call again returns the same claim.

Handle each status

statusWhat to do in the app
ReferralClaimStatus.claimedNothing more. The webhook is on its way
ReferralClaimStatus.flaggedNothing more. Your backend decides from the referral.flagged event
ReferralClaimStatus.ignoredNothing. A reward is never granted twice from our side
ReferralClaimStatus.noneCarry on. The install did not come from a referral link

none is an ordinary answer, not an error. The result also carries referralId, linkId, linkUrl, matchMethod, isExact, matchConfidence, flags, duplicateOf, updated and replayState.

For rewards of value, claim from your backend with POST /v1/referrals/claims and let your own rules decide when a sign-up has earned one. See Claim from the SDK or from your backend.

Receive the webhook

Your endpoint receives referral.claimed within seconds of the claim. Verify the signature on the raw body, skip an event id you have seen, then grant the reward in your own system:

Receive referral webhooks has the signature code for Node.js and Python, and Reward recipes shows how to turn an event into a reward.

Test it

Test on a real phone. On Android, install from a Google Play internal testing track. On iPhone, install from TestFlight or the App Store, then paste the invitation. Test referrals lists the steps and the checks.

Next