我正在使用purchases_flutter和revenueCat在我的应用程序上提供订阅。如何在付款后立即运行功能?
azpvetkf1#
使用RevenueCat,您可以在购买行之后执行任何操作。
static Future<Package?> makePurchases(Package? package, ValueNotifier<bool> isWaiting) async { try { isWaiting.value = true; purchaserInfo = await Purchases.purchasePackage(package!); await Purchases.syncPurchases(); if (purchaserInfo.entitlements.all["Pro"]!.isActive) { purchaserInfo = await Purchases.purchasePackage(package); } // here purchase is done // do something isWaiting.value = false; } on PlatformException catch (e) { var errorCode = PurchasesErrorHelper.getErrorCode(e); if (errorCode != PurchasesErrorCode.purchaseCancelledError) {} isWaiting.value = false; } isWaiting.value = false; return null; }
1条答案
按热度按时间azpvetkf1#
使用RevenueCat,您可以在购买行之后执行任何操作。