# PurchaseController

An abstract class for handling custom purchase flows and subscription management.

> **Warning**

Implementing a custom PurchaseController is advanced functionality. Most developers should use the default purchase controller with RevenueCat integration.



> **Info**

For RevenueCat integration, see the [Using RevenueCat guide](/docs/flutter/guides/using-revenuecat) instead of implementing a custom PurchaseController.



Purpose [#purpose]

Allows custom implementation of purchase flows, subscription validation, and cross-platform purchase handling.

Signature [#signature]

```dart
abstract class PurchaseController {
  Future<PurchaseResult> purchaseFromAppStore(String productId);
  Future<PurchaseResult> purchaseFromGooglePlay(
    String productId,
    String? basePlanId,
    String? offerId,
  );
  Future<RestorationResult> restorePurchases();
}
```

Parameters [#parameters]

<TypeTable
  type="{
  purchaseFromAppStore: {
    type: &#x22;productId: String&#x22;,
    description: &#x22;Handles iOS App Store purchases.&#x22;,
    required: true,
  },
  purchaseFromGooglePlay: {
    type: &#x22;productId: String, basePlanId: String?, offerId: String?&#x22;,
    description: &#x22;Handles Google Play Store purchases with optional base plan and offer.&#x22;,
    required: true,
  },
  restorePurchases: {
    type: &#x22;None&#x22;,
    description: &#x22;Restores previous purchases across platforms.&#x22;,
    required: true,
  },
}"
/>

Returns / State [#returns--state]

* `purchaseFromAppStore` and `purchaseFromGooglePlay` return `Future<PurchaseResult>`
* `restorePurchases` returns `Future<RestorationResult>`

Usage [#usage]

For most use cases, use RevenueCat integration instead:

See the [Using RevenueCat guide](/docs/flutter/guides/using-revenuecat) for complete setup instructions.

Custom implementation is only needed for advanced use cases where you have your own purchase handling system.