Connecting Google Play Billing
Connect your Google Play Console to manage Android in-app purchases and auto-renewable subscriptions alongside your web and African payment rails.
Google Play Billing integration is currently in testing. For production deployments using Paystack, Flutterwave, or Stripe, no Google Play configuration is required.
Step 1: Create a Google Cloud Service Account
SolydFlow communicates with the Google Play Developer API (androidpublisher) to verify purchase tokens and acknowledge subscriptions.
- Open the Google Cloud Console.
- Ensure your project is linked to your Google Play Console account.
- Navigate to IAM & Admin → Service Accounts → Create Service Account.
- Name the account (e.g.
solydflow-play-billing). - Grant the Service Account User role.
- Once created, click Keys → Add Key → Create New Key → JSON.
- Download the
.jsonservice account key file to your computer.
Step 2: Grant Permissions in Google Play Console
- Open the Google Play Console.
- Go to Users and Permissions → Invite New User.
- Paste the email address of the service account you created in Step 1 (e.g.,
solydflow-play-billing@...iam.gserviceaccount.com). - Under App Permissions, select your Android application.
- Under Financial Permissions, grant:
- View financial data, orders, and cancellation survey responses
- Manage orders and subscriptions
- Click Invite User and accept the invitation.
Step 3: Add Credentials to the SolydFlow Vault
- Open the SolydFlow Console.
- Go to Project Settings → API Credentials Vault → Google Play.
- Enter your Android Package Name (e.g.,
com.company.myapp). - Upload the Google Cloud Service Account
.jsonkey file. - Click Save Encrypted Configuration.
Step 4: Configure Real-Time Developer Notifications (RTDN)
Google Play uses Google Cloud Pub/Sub to dispatch real-time events for renewals, grace periods, and cancellations:
- In the SolydFlow Console, navigate to Project Settings → Inbound Gateway Webhook Configurations.
- Copy your unique Google Play Webhook endpoint.
- In Google Cloud Pub/Sub, create a Topic and assign SolydFlow's endpoint as a Push Subscription.
- In Google Play Console, go to Monetize → Monetization Setup → Real-time developer notifications, enter your topic name, and click Save Changes.
The 3-Day Acknowledgment Rule
Google Play automatically cancels and refunds any in-app purchase that is not acknowledged within 3 days.
When using SolydFlow, you never need to write manual acknowledgment logic in your app. As soon as the client submits a purchaseToken, the Consensus Engine verifies the receipt and immediately issues an authenticated POST /acknowledge call to Google Play before recording SETTLED_CONSENSUS in your ledger.
Restoring Purchases in Code
When a customer changes Android devices or reinstalls your app, restore their entitlements:
- Flutter
import 'package:flutter/material.dart';
import 'package:solydflow_flutter/solydflow_flutter.dart';
Future<void> restoreAndroidPurchases(BuildContext context) async {
try {
final CustomerInfo info = await SolydFlow.restorePurchases();
if (info.activeEntitlements["pro_access"] == true) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("🎉 Purchases successfully restored!")),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("No active subscriptions found.")),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Restore error: $e")),
);
}
}