purchases library

Store purchases for apps that sell: cloud.purchases (FFXCloudPurchases), what the app sells in the App Store and Google Play and what the signed-in end user bought.

import 'package:flutterflow_cloud/flutterflow_cloud.dart';
import 'package:flutterflow_cloud/purchases.dart';

final state = await FlutterFlowCloud.instance.purchases.read();

package:flutterflow_cloud/flutterflow_cloud.dart doesn't export this library, so an app that sells nothing never sees the getter, and its own generated purchases getter (a purchase model) stays as it is. Once the config sells, the generator names that model's getter purchaseCollection, so cloud.purchases is this library's.

Errors a purchase or a credit-spending write throws (FFXInsufficientCreditsError and the rest) come from the main library.

Classes

FFXCredits
The app's credits, as they stand for the end user. The balance lives on the backend, never counted on the phone: spending is a backend rule's.
FFXProduct
One product the app sells, with each store's id for it.
FFXPurchase
One store purchase of the end user's.
FFXPurchaseEvent
One thing the app's paywall or shop saw, with no content, for FFXPurchases.recordEvents.
FFXPurchases
Store purchases surface (docs/architecture/payments-ux.md ยง11): what the app sells in the App Store and Google Play, and what the signed-in end user bought.
FFXPurchaseState
The end user's purchases, and what the app sells.
FFXUpgrade
The upgrade, as it stands for the end user.

Enums

FFXProductKind
What a product is: the upgrade, an unlock, or a pack of credits.
FFXPurchaseEventKind
What the app's paywall and shop saw: the paywall or the shop shown, a plan or pack picked, a purchase started in the store's sheet or cancelled there.
FFXStore
The two stores, and drip's pretend store in the preview.

Extensions

FFXCloudPurchases on FlutterFlowCloud
cloud.purchases, for apps that sell. It is an extension in its own library, package:flutterflow_cloud/purchases.dart, rather than a member of FlutterFlowCloud: an instance member would shadow the generated purchases getter of every app with a purchase model.