Skip to main content

zuraffa_purchase 0.1.1 copy "zuraffa_purchase: ^0.1.1" to clipboard
zuraffa_purchase: ^0.1.1 copied to clipboard

Purchase support for the Zuraffa ecosystem: a typed in-app purchase port behind a service, with the StoreKit / Play Billing adapters shipped as federated siblings.

zuraffa_purchase #

Typed in-app purchases for the Zuraffa ecosystem: a pure-Dart purchase port behind a service, with federated adapters that talk to StoreKit and Play Billing through package:in_app_purchase.

Part of the zuraffa_purchase federated monorepo, built on the Zuraffa framework.

Use #

Register the adapter of the running platform first — it puts the store on the locator — then wire the purchase family over it:

import 'package:zuraffa_purchase/zuraffa_purchase.dart';
import 'package:zuraffa_purchase_macos/zuraffa_purchase_macos.dart';

registerMacosPurchaseDependencies(getIt); // zuraffa_purchase_{macos,ios,android}
registerPurchaseDependencies(getIt);

final service = getIt<PurchaseService>();

final products = await service.products(['pro.monthly']);
final outcome = await service.purchase(
  const PurchaseIntent(productId: 'pro.monthly'),
);
if (outcome.pendingFinish) {
  await service.finish(outcome.transactionId);
}

Without a registered store every call surfaces the typed PurchaseNotWired failure — a mis-registered adapter shows up at the first purchase, never as a silent no-op.

Failures are typed: PurchaseException carries a stable machine code (cancelled, product_unavailable, store_unavailable, pending) and a recoverable flag.

Handing the store to zuraffa_subscriptions #

PurchaseSubscriptionStore implements the SubscriptionStorePort of zuraffa_subscriptions, so an app derives entitlements from real store transactions without writing its own adapter:

final store = getIt<PurchaseSubscriptionStore>();
final service = SubscriptionService(store: store);

Develop #

dart pub get
dart test
0
likes
150
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Purchase support for the Zuraffa ecosystem: a typed in-app purchase port behind a service, with the StoreKit / Play Billing adapters shipped as federated siblings.

Homepage
Repository (GitHub)
View/report issues

Topics

#purchase #clean-architecture #zuraffa

License

MIT (license)

Dependencies

zuraffa, zuraffa_subscriptions

More

Packages that depend on zuraffa_purchase