RevenueCat
If your app sells through RevenueCat, LinkForty can take purchases, renewals and refunds straight from RevenueCat. Each one is credited to the link that brought the install. You need no backend code: RevenueCat sends its webhook to LinkForty, and your app adds one line that tells RevenueCat which LinkForty install each customer is.
- LinkForty Cloud, any plan. Admins and owners connect it; everyone in the workspace can see whether it's connected and delivering.
- RevenueCat sends webhooks on its Pro plan.
- One of the LinkForty mobile SDKs in your app, for
getInstallId().
Connect
- In LinkForty, open Settings → Integrations. Under Revenue sources, click Connect RevenueCat.
- Copy the webhook URL and the Authorization header value. The header value is shown once. If you lose it, click Get a new one: the old one stops working at once, so update RevenueCat right after.
- In RevenueCat, go to Integrations → Webhooks and add a webhook. Paste the URL, and paste the header value into the Authorization header field.
- Tag purchases with the LinkForty install. See the next section.
- On the webhook's page in RevenueCat, send a test event. The card in LinkForty shows the delivery within a few seconds.
Tag purchases with the LinkForty install
RevenueCat knows your customer, not which link brought them. Set a RevenueCat attribute named linkforty_install_id to the LinkForty install id. Do it after the LinkForty SDK has started and RevenueCat is configured, and again before each purchase: on a first launch the install id is empty until the SDK has reported the install, so code that runs only once at startup can miss it. RevenueCat then includes it in its webhooks for that customer.
React Native
import LinkForty from '@linkforty/mobile-sdk-react-native';
import Purchases from 'react-native-purchases';
const installId = await LinkForty.getInstallId();
if (installId) Purchases.setAttributes({ linkforty_install_id: installId });
Expo
import LinkForty from '@linkforty/mobile-sdk-expo';
import Purchases from 'react-native-purchases';
const installId = await LinkForty.getInstallId();
if (installId) Purchases.setAttributes({ linkforty_install_id: installId });
iOS (Swift)
if let installId = LinkForty.shared.getInstallId() {
Purchases.shared.attribution.setAttributes(["linkforty_install_id": installId])
}
Android (Kotlin)
LinkForty.shared.getInstallId()?.let { installId ->
Purchases.sharedInstance.setAttributes(mapOf("linkforty_install_id" to installId))
}
Flutter
final installId = LinkForty.instance.getInstallId();
if (installId != null) {
Purchases.setAttributes({'linkforty_install_id': installId});
}
RevenueCat doesn't send the attribute on every delivery. A delivery without it is credited to the install of an earlier event of the same subscription (the same original_transaction_id). With neither, it can't be credited to a link: it's refused with MISSING_INSTALL_ID, which you can see in the request log.
What LinkForty records
| RevenueCat event | LinkForty event | Revenue |
|---|---|---|
INITIAL_PURCHASE with a trial (period_type TRIAL) | trial_start | none |
INITIAL_PURCHASE | subscription_start | the price |
RENEWAL | renewal | the price |
NON_RENEWING_PURCHASE | purchase | the price |
CANCELLATION because of a refund (cancel_reason CUSTOMER_SUPPORT) | refund | the refunded amount, negative |
CANCELLATION, any other reason | subscription_cancelled | none |
REFUND_REVERSED | refund_reversed | the amount, positive |
EXPIRATION | subscription_expired | none |
BILLING_ISSUE | billing_issue | none |
PRODUCT_CHANGE | product_change | none |
TEST | nothing; shown as received | — |
| Any other type | nothing; shown as received | — |
- Revenue is
price_in_purchased_currencyin the purchase'scurrency. LinkForty doesn't convert currencies. - Gross or net: gross by default. Choose Net of store fees and tax on the card to take out the store commission and the tax RevenueCat estimates (
commission_percentage,tax_percentage). RevenueCat sends these only sometimes; a purchase without them counts in full. - Time: each event counts on the day RevenueCat generated it (
event_timestamp_ms). For App Store renewals, Apple can charge up to a day early, so the purchase time isn't used. - Kept with each event: store, product id, period type, cancel reason and country, as event properties.
- Refunds are linked to the purchase they reverse by its
transaction_id, or failing that to the newest purchase of the same subscription, so they come off that purchase's link, even if the customer has since reinstalled the app. - How much a refund takes off: the same share of what the purchase counted as the refund is of the price. A full refund takes back exactly what the purchase added, in gross or net, whatever fee fields either delivery carried.
- Unmatched refunds: a refund for a purchase LinkForty never recorded subtracts nothing and is refused with
REFUND_WITHOUT_PURCHASE. AREFUND_REVERSEDgives back what its refund took, on the refund's link; one for a refund LinkForty never recorded is refused withREVERSAL_WITHOUT_REFUND. - Refunds count on the day they happen, not on the purchase's day. A purchase in one week refunded in a later week shows the full amount in the first week and the refund in the later one.
- Sandbox purchases (
environmentSANDBOX) are matched and shown in the request log, but not stored. Test the whole flow with them before going live.
To count a purchase as a conversion, add its event name (such as subscription_start) as a goal.
Avoid counting purchases twice
If your app also sends purchases with trackRevenue(), the same purchase would arrive twice: once from the app, once from RevenueCat. Under Settings → Server events → Revenue comes from, set App revenue to From your server or RevenueCat. From then on, revenue for those events comes only from RevenueCat. The card on the Integrations page reminds you while this is off. See Revenue from your server.
Webhook signing (optional)
If you set a signing secret on the webhook in RevenueCat, paste the same secret into Webhook signing secret on the card. LinkForty then checks the signature on every delivery, and refuses one that is unsigned, altered or more than 5 minutes old.
Delivery and the request log
- LinkForty answers RevenueCat as soon as a delivery is stored, then processes it. RevenueCat's retries of the same event are recognized by its event id and recorded once.
- Deliveries for a suspended workspace are refused with 403.
- Every delivery, with its outcome, is in Settings → Server events. From the card, click See every delivery.
- Disconnect stops accepting deliveries at once. Connecting again gives a new header value.
Limits
- Refunds of earlier periods: RevenueCat sends a refund only when the latest subscription period is refunded. A refund of an earlier period never arrives, so LinkForty can't subtract it.
- Purchases before connecting: a refund of a purchase made before RevenueCat was connected, or before the app set the attribute, isn't subtracted.
- 30-day age limit: an event that reaches LinkForty more than 30 days after RevenueCat generated it is refused with
TIMESTAMP_TOO_OLD. RevenueCat stops retrying after about 80 minutes, so this matters only for deliveries you resend by hand. - Matching: by the
linkforty_install_idattribute, or an earlier event of the same subscription that had it. Customers who bought before the app set it can't be credited. - Not recorded:
TRANSFERand other event types outside the table.