Question

Debug console getting data but I call payment screen

  • 28 August 2021
  • 1 reply
  • 29 views

Badge

Hello, last day I watched this video Youtube Link and I made what he made. 

 

fetchOffers()


Future fetchOffers() async {
final offerings = await PurchaseApi.fetchOffers();
final offer = offerings.first;
print('Teklifler: $offer');
final packages = offerings
.map((offer) => offer.availablePackages)
.expand((pair) => pair)
.toList();

(context) => PaywallWidget(
packages: packages,
title: 'Become Gold',
description: 'Gold Test',
onClickedPackage: (package) async {
await PurchaseApi.purchasePackage(package);
Navigator.pop(context);
},
);
}

 My RevenueCatProvider.dart:

class RevenueCatProvider extends ChangeNotifier {
RevenueCatProvider() {
init();
}

Entitlement _entitlement = Entitlement.free;
Entitlement get entitlement => _entitlement;

Future init() async {
Purchases.addPurchaserInfoUpdateListener((purchaserInfo) async {
updatePurchaseStatus();
});
}

Future updatePurchaseStatus() async {
final purchaserInfo = await Purchases.getPurchaserInfo();
final entitlements = purchaserInfo.entitlements.active.values.toList();
_entitlement =
entitlements.isEmpty ? Entitlement.free : Entitlement.allCourses;

notifyListeners();
}
}

 

 final entitlement = Provider.of<RevenueCatProvider>(context).entitlement;

I make this as comment on codes because 

Its giving me this error

Undefined name 'Provider'.
Try correcting the name to one that is defined, or defining the name

 

My debug console:

W/ProviderInstaller(17141): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.

W/ConnectivityManager.CallbackHandler(17141): callback not found for CALLBACK_AVAILABLE message

W/FLTFireMsgService(17141): Attempted to start a duplicate background isolate. Returning...

I/flutter (15063): Offers: Offering{identifier: subscriptions, serverDescription: Standart set of subscription, availablePackages: [Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: GoldSubscription, description: test, title: Gold Abone (TestRevenueCatAPP), price: 2.39, priceString: TRY 2.39, currencyCode: TRY, introductoryPrice: null}, offeringIdentifier: subscriptions}], lifetime: null, annual: null, sixMonth: null, threeMonth: null, twoMonth: null, monthly: Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: goldabone, description: test, title: Gold Subscription (TestRevenueCatAPP), price: 2.39, priceString: TRY 2.39, currencyCode: TRY, introductoryPrice: null}, offeringIdentifier: subscriptions}, weekly: null}



I can see on debug console but I can't redirect to google pop-up buy menu. 

How can I redirect a button to do it?

onPressed: isLoading ? null : fetchOffers

My onPress debug log:

 

D/[Purchases] - DEBUG(17141): ℹ️ Vending Offerings from cache
D/[Purchases] - DEBUG(17141): ℹ️ Checking if cache is stale AppInBackground false
I/flutter (17141): Teklifler: Offering{identifier: subscriptions, serverDescription: Standart set of subscription, availablePackages: [Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: goldabone, description: test, title: Gold Abone (TestRevenueCatAPP), price: 2.39, priceString: TRY 2.39, currencyCode: TRY, introductoryPrice: null}, offeringIdentifier: subscriptions}], lifetime: null, annual: null, sixMonth: null, threeMonth: null, twoMonth: null, monthly: Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: goldabone, description: test, title: Gold Abone (TestRevenueCatAPP), price: 2.39, priceString: TRY 2.39, currencyCode: TRY, introductoryPrice: null}, offeringIdentifier: subscriptions}, weekly: null}

 

Sorry I’m new on flutter and revenuecat.

Thank you all.

Have a good day.


1 reply

Userlevel 3
Badge +6

Hey @Ferhat Özkan!

It looks like there are some custom classes here, like PurchaseApi - this isn’t a part of the Purchases SDK, so it’s tough to tell what might be happening here. Are you able to reproduce this issue in our Flutter sample app, MagicWeather?

 

 

Reply