Guide · iOS (Swift)
Add an affiliate or referral program to your iOS app.
The InfluTo Swift package works in SwiftUI and UIKit apps. It tells you which creator referred an install, takes typed referral codes, and gets each purchase verified, through RevenueCat or straight from StoreKit 2 and the App Store Server API.
Updated November 1, 2026
In short
Add the Swift package github.com/influto/influto-ios to your app target, call InfluTo.initialize once at launch from a Task, then checkAttribution and identifyUser. Without RevenueCat, StoreKit 2 capture is built in: the SDK observes Transaction.updates and back-fills current entitlements, and you also call reportPurchase(verification:) right after product.purchase() succeeds. With RevenueCat, pass a revenueCatAttributeSetter so the SDK can tag the subscriber. iOS 16+, no third-party dependencies, no IDFA and no ATT prompt. Plan for an afternoon.
What you get
The package depends only on Foundation, StoreKit 2 and CryptoKit, ships through Swift Package Manager (there's no CocoaPods pod) and is MIT-licensed. It needs iOS 16 and Swift 5.9 (Xcode 15) or newer, and also builds for macOS 13, tvOS 16 and watchOS 9.
Attribution without tracking. A typed code is an exact match; otherwise link-click matching connects the install to a recent tap on the creator's link, within 72 hours. No advertising identifier and no device characteristics, so no App Tracking Transparency prompt.
A SwiftUI code field. InfluToReferralCodeInput validates as the user types and applies the code on tap. In UIKit, host it in a UIHostingController.
StoreKit 2 capture built in. On store-direct apps the SDK reports purchases itself, and InfluTo verifies each signed transaction with Apple.
Step 1: add the Swift package
In Xcode, choose File → Add Package Dependencies, paste the repository URL and add the InfluTo library to your app target. Or declare it in Package.swift:
// Xcode → File → Add Package Dependencies →
// https://github.com/influto/influto-ios (from 1.1.1)
// Or in Package.swift:
.package(url: "https://github.com/influto/influto-ios.git", from: "1.1.1")Step 2: initialize at launch
Every SDK method is async. Call initialize once at launch from a Task and wait for it. It throws when it fails (a wrong key, no network): catch it, log it and carry on; the next launch tries again. In UIKit, start the Task from application(_:didFinishLaunchingWithOptions:).
checkAttribution never throws. On an error, or if initialize hasn't succeeded, it returns attributed == false and stores nothing. A positive answer is stored on the device, so later calls return it without a request.
The API key (it_…, on Setup & SDK) covers development and production. Keep it out of committed source, for example in an .xcconfig that isn't checked in, read through Info.plist. A typical SwiftUI startup on a RevenueCat app:
import SwiftUI
import InfluTo
import RevenueCat // only if you use RevenueCat
@main
struct MyApp: App {
init() {
Purchases.configure(withAPIKey: "appl_…") // RevenueCat apps: configure it first
Task { await startInfluTo() }
}
var body: some Scene { WindowGroup { ContentView() } }
}
func startInfluTo() async {
var config = InfluToConfig(
apiKey: Bundle.main.object(forInfoDictionaryKey: "INFLUTO_API_KEY") as? String ?? "",
appVersion: Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
)
config.revenueCatAttributeSetter = { attrs in
Purchases.shared.attribution.setAttributes(attrs)
}
do {
try await InfluTo.initialize(config)
} catch {
print("InfluTo initialize failed: \(error)") // retried on the next launch
return
}
let attribution = await InfluTo.checkAttribution()
await InfluTo.identifyUser(Purchases.shared.appUserID)
}Step 3: connect purchases
InfluTo only pays commission on purchases verified with the store. Pick one path for iOS:
RevenueCat: pass a revenueCatAttributeSetter, as in MyApp.swift above; without it, nothing sets the attribute on iOS. The SDK calls it once, when the referral is found, so configure RevenueCat before checkAttribution. Then connect the webhook on Setup & SDK.
Store-direct (StoreKit 2): when the app is set to store-direct in Settings → Validation, initialize starts observing Transaction.updates and back-fills current entitlements and unfinished transactions. Each transaction is reported once, keyed on its original transaction ID. The SDK never calls finish(); your app still finishes its transactions.
One StoreKit detail matters: purchases made inside your app go back to the caller of product.purchase(), not to the background listener. So report right after a successful purchase, as below. Reports are de-duplicated, so a purchase reported here and by auto-capture still counts once.
To tie transactions to your user ID, pass StoreKit's account token: product.purchase(options: [.appAccountToken(InfluTo.appAccountToken(forUserID: userID))]), the same UUID every time for a given user ID. reportPurchase throws InfluToError.retryable on a 503 (retry later) and InfluToError.notConfigured on a 400 (iOS isn't store-direct yet).
// Store-direct only (no RevenueCat). Report right after a purchase — StoreKit
// doesn't send purchases made in your app to the background listener, and
// reports are de-duplicated, so this is safe alongside auto-capture:
if case .success(let verification) = try await product.purchase() {
let r = try await InfluTo.reportPurchase(verification: verification)
}Step 4: add your App Store Server API key
Store-direct needs read access to the App Store Server API. InfluTo only reads; it never changes anything in your App Store Connect account.
- 1
Create the key. In App Store Connect, open Users and Access → Integrations → In-App Purchase, create a key and download the .p8 file. Apple lets you download it once. Note the Issuer ID and the Key ID.
- 2
Upload it. In InfluTo, open Settings → Validation, drop in the .p8 (the Key ID is read from Apple's default file name), and enter the Issuer ID, the Key ID and the app's numeric App Store ID.
- 3
Pick the environment, then switch. Choose Sandbox while you test with TestFlight or sandbox testers, Production before release. When the credential check is green, set iOS to Apple — direct. Until then reports get a 400, so shipping the SDK first is safe.
From then on InfluTo checks attributed subscriptions with Apple every hour for renewals, cancellations and refunds, and reverses commission on refunds. No backend of your own needed.
Step 5: test with TestFlight or a sandbox tester
TestFlight and sandbox purchases never move money or change your stats:
- 1
Simulate a purchase. Simulate a purchase on Setup & SDK sends a sandbox test purchase through InfluTo's real pipeline. It checks InfluTo's side only, never your credentials.
- 2
Install through a referral link. Join your campaign with a second creator account, open its link on a test device, install your TestFlight build and launch. Typing the code is the most reliable test.
- 3
Buy with a sandbox account. With the Apple environment set to Sandbox, buy with a TestFlight or sandbox tester. The Integration log, switched to Sandbox, shows the purchase attributed to your code.
Switch the environment back to Production before release: InfluTo verifies against exactly the environment you pick. clearAttribution() resets the device for another run.
iOS notes
Details that matter for review and for store-direct:
StoreKit 2 only. Store-direct needs the signed transaction (JWS); never send the unsigned JSON representation. The SDK sends the JWS even when on-device verification fails, and InfluTo verifies it on the server.
Privacy manifest included. The package ships PrivacyInfo.xcprivacy: no tracking, no tracking domains, and the data types it collects, not linked to identity. The privacy docs map it to your App Privacy answers.
Local state. The SDK keeps its state in the com.influto.sdk UserDefaults suite. It survives app updates; deleting the app removes it.
Or let your coding agent do it
Connect InfluTo's MCP server to Claude Code, Codex or Cursor and ask for the integration: the agent writes the startup and purchase code, hands you a link to upload the .p8 yourself, runs the credential check and confirms an attributed sandbox purchase.
iOS affiliate SDK, answered.
Is there an affiliate SDK for iOS apps written in Swift?
Yes. The InfluTo Swift package (github.com/influto/influto-ios, MIT) adds referred-install detection, referral codes and purchase attribution to SwiftUI and UIKit apps. It needs iOS 16 and Swift 5.9 or newer and has no third-party dependencies.
Can I track influencer referrals on iOS without the ATT prompt?
Yes. InfluTo doesn't use the IDFA and never matches by device characteristics; typed codes are exact and link-click matching is a 72-hour fallback limited to your app. The package's privacy manifest declares no tracking.
Does it work without RevenueCat?
Yes. StoreKit 2 capture is built in, and InfluTo verifies each signed transaction with the App Store Server API, using a read-only In-App Purchase key you upload. You don't need a server of your own.
Is there a CocoaPods pod?
No. The SDK ships through Swift Package Manager only and is listed on the Swift Package Index.
Do TestFlight purchases work?
Yes, when the app's Apple environment is set to Sandbox in Settings → Validation. TestFlight and sandbox purchases show up in the Integration log but never move money or change your stats.
What does it cost?
$0 a month. Per verified purchase you pay the commission you set plus 10% of the same revenue (7%, 5% or 3% at volume). The prepaid wallet starts at $50 and is refundable; InfluTo pays creators monthly through Stripe Connect in 33 countries once they've earned $20.
Ship referral codes in your next TestFlight build.
One Swift package, one validation path, a refundable deposit. $0 a month; 10% only on revenue creators bring in.
Start free