Mobile SDKs
Native and cross-platform SDKs that wrap the store's purchase flow and report the receipt to EntitleHub, which verifies it server-side and resolves it to entitlements. Same shape everywhere: configure once, then purchase() and isEntitled().
Every SDK exposes the same surface: configure, customerInfo, isEntitled, check, offerings, purchase, restorePurchases, and a customer-info listener, so the concepts carry across your iOS, Android, Flutter, and React Native apps.
Swift (iOS / macOS)
Native StoreKit 2. Add via Swift Package Manager:
.package(url: "https://github.com/DanCue44/entitlehub-swift", from: "0.1.0")import EntitleHub
EntitleHub.configure(apiKey: "pk_live_…", appUserId: user.id)
let info = try await EntitleHub.shared.purchase("pro_monthly")
if info.isActive("pro") { unlockPro() }Android (Kotlin)
Native Google Play Billing v7. Add via JitPack, in settings.gradle.kts add the JitPack repo, then:
implementation("com.github.DanCue44:entitlehub-android:0.1.0")import com.entitlehub.EntitleHub
EntitleHub.configure(context, apiKey = "pk_live_…", appUserId = user.id)
val info = EntitleHub.purchase(activity, "pro_monthly", isSubscription = true)
if (info.isActive("pro")) unlockPro()Flutter
Over in_app_purchase. Add as a git dependency in pubspec.yaml:
dependencies:
entitlehub:
git: { url: https://github.com/DanCue44/entitlehub-flutter, ref: "0.1.0" }
in_app_purchase: ^3.2.0import 'package:entitlehub/entitlehub.dart';
EntitleHub.instance.configure(apiKey: 'pk_live_…', appUserId: user.id);
final info = await EntitleHub.instance.purchase('pro_monthly', isSubscription: true);
if (info.isActive('pro')) unlockPro();React Native / Expo
Over expo-iap (works in bare React Native and Expo):
npm install @entitlehub/react-native expo-iapimport { configureEntitleHub, purchaseProduct, isEntitled } from "@entitlehub/react-native";
await configureEntitleHub({ apiKey: "pk_live_…", appUserId: user.id });
const info = await purchaseProduct("pro_monthly", { isSubscription: true });
if (info.isActive("pro")) unlockPro();.NET (Unity / MAUI)
C# client for Unity, .NET MAUI, and Xamarin (targets .NET Standard 2.0 + .NET 8):
dotnet add package EntitleHubusing EntitleHub;
var eh = new EntitleHubClient(apiKey: "pk_live_…", appUserId: user.Id);
if (await eh.IsEntitledAsync("pro")) UnlockPro();
// After UnityEngine.Purchasing (or your billing lib) completes the buy, report the receipt:
var info = await eh.ReportApplePurchaseAsync(signedTransaction); // iOS StoreKit 2 JWS
// or: await eh.ReportPlayPurchaseAsync(productId, purchaseToken, isSubscription: true);In Unity, install via NuGetForUnity or drop the netstandard2.0 DLL into Assets/Plugins/; drive the purchase sheet with UnityEngine.Purchasing and hand the receipt to the client.
Apple StoreKit 2 receipts are self-verifying (nothing to configure). Google Play and Stripe need a credential in Settings → Store credentials so EntitleHub can validate the purchase server-side. Add the store server-notification endpoints there too, so renewals, cancels, and refunds stay in sync.
Handling purchase outcomes
Purchases can end in more than success or failure. Every SDK surfaces a typed error. Branch on the code, never the message. In particular a pending result (Ask-to-Buy, SCA, deferred payment) is nota failure: the entitlement lands later and your customer-info listener fires when it does. Show a "confirming" state, not an error.
Not on a native platform? The JavaScript SDK works anywhere JS runs, and you can always report a validated purchase over the REST API.
