Skip to main content

Purchases work fine, but I realised my users take no further steps as expected. So I debugged with a Appstoreconnect Sandbox user and real iPhone device.

After the purchase in PaywallFooterView(), log shows both debugPrints from onPurchaseCompleted, but navigation inbetween gets ignored. A bit strange since not async. Navigation in onDismissed gets executed.

I can probably workaround by settings flags in onPurchaseCompleted, and navigate to another page in onDismissed, but I think this is unexpected behaviour?


Log:

flutter: 🟩💰 onPurchaseCompleted msg

gpaywalls] DEBUG: ℹ️ Looking up localization but found no strings

flutter: 🟩💰 onPurchaseCompleted - Transaction: xyz

flutter: 🟩💰 onDismiss

flutter: Page2 opened

 

Code in PaywallFooterView():

onPurchaseCompleted: (CustomerInfo customerInfo, StoreTransaction transaction) {

debugPrint('🟩💰 onPurchaseCompleted msg);

Navigator.of(context).push(MaterialPageRoute(builder: (context) => Page1()));

debugPrint('🟩💰 onPurchaseCompleted - Transaction: ${transaction.transactionIdentifier}');

},

onDismiss: () {

debugPrint('🟩💰 onDismiss');

Navigator.of(context).push(MaterialPageRoute(builder: (context) => Page2()));

 

Could be a race condition. onRestoreCompleted sometimes is followed by onDismiss, sometimes not..


Hey there,

 

This is all remotely configured and RevenueCatUI handles all the intro offer eligibility and purchase logic. You will still need to handle what happens around the paywall opening. 

When using PaywallFlutterView, you may use one of the provided listeners to react to user actions. Available listeners at this time are:

  • onPurchaseStarted
  • onPurchaseCompleted
  • onPurchaseError
  • onRestoreCompleted
  • onRestoreError
  • onDismiss

 

In this case, I would recommend reacting to onPurchaseCompleted in order to do something after the purchase is made. 

 

Let me know if that helps! 


I’m on

  • onPurchaseCompleted
  • onDismiss

(see end of 1st post).

Navigation within onPurchaseCompleted gets ignored, onDismiss seems to interrupt it’s execution.


Any action that removes current widgets should be done in onDismiss, only! Else a widget reference exception occurs. This includes

- Navigation, removing the view..

See https://www.revenuecat.com/docs/tools/paywalls/displaying-paywalls#how-to-display-a-footer-paywall-on-your-custom-paywall-3

The other callbacks should only set flags to be evaluated in onDismiss. Not sure if onDismiss ALWAYS gets called, tho.


Reply