Skip to main content
Solved

Detect a Successful/Unsuccessful Purchase

  • January 13, 2022
  • 1 reply
  • 440 views

Forum|alt.badge.img+4

New to RevenueCat and cannot seem to find the solution to what to do after making a purchase with this code in Flutter:

PurchaserInfo purchaserInfo = await Purchases.purchasePackage( _selectedPackage);

How do I properly determine if the purchase to a subscription was successful or not successful so that I can navigate the user properly?

 

 

Best answer by ryan

Hey @Paul Sarknas!

After the .purchasePackage() call returns, you can check the subscription status of the PurchaserInfo object to determine if the customer is “premium” or not and navigate them appropriately. The code to check this is probably similar to what you would do on app launch to navigate free vs. paid customers to the appropriate screen and may be something like:

if (purchaserInfo.entitlements.all["my_entitlement_identifier"].isActive) {
    // Unlock that great "pro" content
}

 

View original
Did this post help you find an answer to your question?

1 reply

ryan
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 391 replies
  • Answer
  • January 14, 2022

Hey @Paul Sarknas!

After the .purchasePackage() call returns, you can check the subscription status of the PurchaserInfo object to determine if the customer is “premium” or not and navigate them appropriately. The code to check this is probably similar to what you would do on app launch to navigate free vs. paid customers to the appropriate screen and may be something like:

if (purchaserInfo.entitlements.all["my_entitlement_identifier"].isActive) {
    // Unlock that great "pro" content
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings