Framework guide

Flutter purchase verification

Verify Google Play and Apple purchases from Flutter — server-side, via REST API. Use your existing IAP plugin; Tierux verifies tokens from your backend.

1

Use any Flutter IAP plugin

Tierux is plugin-agnostic. Use in_app_purchase (official), flutter_inapp_purchase, or purchases_flutter — any plugin that gives you a purchase token. Tierux handles verification server-side.

// pubspec.yaml
dependencies:
  in_app_purchase: ^3.1.0
2

Get the purchase token

After a successful purchase, retrieve the token or JWS and send it to your backend for server-side verification.

// In your Flutter app — listen for completed purchases
InAppPurchase.instance.purchaseStream.listen((purchases) {
  for (final PurchaseDetails purchase in purchases) {
    if (purchase.status == PurchaseStatus.purchased) {
      _verifyWithBackend(purchase);
      InAppPurchase.instance.completePurchase(purchase);
    }
  }
});

// Initiate purchase (returns a stream, not a purchase result)
InAppPurchase.instance.buyNonConsumable(
  purchaseParam: purchaseParam,
);

// Send purchase token to your backend
Future<void> _verifyWithBackend(PurchaseDetails purchase) async {
  final response = await http.post(
    Uri.parse('https://your-api.com/verify'),
    headers: {'Content-Type': 'application/json'},
    body: jsonEncode({
      'platform': Platform.isAndroid ? 'android' : 'ios',
      'purchaseToken': purchase.verificationData.serverVerificationData,
      'productId': purchase.productID,
      'packageName': 'com.yourapp',
    }),
  );
}
3

Verify from your backend (any language)

Your backend calls Tierux's REST API. Here's a Dart shelf example, but any language works — the API is plain HTTP.

// Your backend (Dart shelf example)
final response = await http.post(
  Uri.parse('https://tierux.com/api/v1/purchases/google-play/verify'),
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: jsonEncode({
    'appId': 'app_123',
    'userId': userId,
    'packageName': 'com.yourapp',
    'productId': 'pro_monthly',
    'purchaseToken': token,
  }),
);
4

Return entitlement state to the Flutter app

Your backend relays the verification result to your app — gate features based on the normalized entitlement state.

// Backend response
return Response.ok(jsonEncode({
  'active': true,
  'entitlement': 'pro',
  'expiresAt': expiry,
}));

// In your Flutter app
if (result['active'] == true) {
  unlockProFeatures();
}
Related guides

Purchase verification

Deep dive on how Tierux verifies tokens server-side for Google Play and Apple.

Entitlement mapping

Map Flutter IAP products to entitlement IDs for cross-platform feature gating.

Quickstart docs

Full integration path with curl examples and language-agnostic endpoints.

Verify Flutter purchases server-side

Free tier — unlimited apps, 1 paywall. No credit card, no revenue share.

Start free