PurchaseController
An abstract class for handling custom purchase flows and subscription management.
Implementing a custom PurchaseController is advanced functionality. Most developers should use the default purchase controller with RevenueCat integration.
For RevenueCat integration, see the Using RevenueCat guide instead of implementing a custom PurchaseController.
Purpose
Allows custom implementation of purchase flows, subscription validation, and cross-platform purchase handling.
Signature
abstract class PurchaseController {
Future<PurchaseResult> purchaseFromAppStore(String productId);
Future<PurchaseResult> purchaseFromGooglePlay(
String productId,
String? basePlanId,
String? offerId,
);
Future<RestorationResult> restorePurchases();
}Parameters
Prop
Type
Returns / State
purchaseFromAppStoreandpurchaseFromGooglePlayreturnFuture<PurchaseResult>restorePurchasesreturnsFuture<RestorationResult>
Usage
For most use cases, use RevenueCat integration instead:
See the Using RevenueCat guide for complete setup instructions.
Custom implementation is only needed for advanced use cases where you have your own purchase handling system.
How is this guide?