Code Monkey home page Code Monkey logo

Comments (8)

aboedo avatar aboedo commented on May 29, 2024 1

That said, if the purchase is PENDING, you'd only get purchaserInfo updated, but no callback.
We're trying to figure out how to improve that behavior (RevenueCat/purchases-android#160), since it's not ideal. See that ticket for details

from purchases-flutter.

liri2006 avatar liri2006 commented on May 29, 2024 1

Well, while workaround "call purchasePackage -> store flag somewhere if PENDING -> assume that particular purchase has finished" can theoretically work but it is not 100% bullet proof.

User can make few purchases in a row, so after receiving purchaserInfo there is no way to know which feature to unlock (except storing previous state of purchaserInfo and comparing what changed on every update).

Adding some kind of purchase life-cycle event stream would give a developer flexibility to implement almost any kind of purchase workflow he wants.

from purchases-flutter.

aboedo avatar aboedo commented on May 29, 2024 1

agreed. moving this to backlog since we'll integrate the fix as soon as we do it on purchases-android. However, I don't know when we'll get to tackle it since we have other items on our plate.

from purchases-flutter.

aboedo avatar aboedo commented on May 29, 2024

you're correct, the listener will only get a value for the updated purchaserInfo.

The purchasePackage and purchaseProduct methods, however, do optionally send an error.
If there's no error, you should be able to assume that the purchase went through correctly. If there's an error, it might be due to a user cancellation. The methods also throw a PlatformException if the purchase was unsuccessful.

from purchases-flutter.

liri2006 avatar liri2006 commented on May 29, 2024

The issue here is that in case of slow purchases payment can go through/fail after few minutes. User can navigate away from the paywall to all different sorts of pages where getPurchaserInfo is called.
And now there is no way to tell why PurchaserInfoUpdateListener was triggered - was it because purchase went through (and which one for that matter) or subscription expired, or some other purchase was made on other device.

PS. Thank you guys for this lib and RevenueCat in general - the service is just great! I was fighting with official flutter plugin for few days - it is such a buggy mess! Then I found RevenueCat and implemented the whole thing in few hours.

from purchases-flutter.

aboedo avatar aboedo commented on May 29, 2024

PS. Thank you guys for this lib and RevenueCat in general - the service is just great! I was fighting with official flutter plugin for few days - it is such a buggy mess! Then I found RevenueCat and implemented the whole thing in few hours

You made my day 😃

Thinking about your case:
yeah, from the listener you wouldn't have a way to find out why the purchaserInfo got updated. And the listener itself doesn't contain the error messages either.

So you would delegate all of that to the completion block of purchasePackage | purchaseProduct.
So when that specific function is called (the completion block of the purchase method), you know, no matter where your app is, that it was called after receiving information about the status of the purchase, and you can react from there. You'll get the latest purchaserInfo as a param of the callback, as well as an error if one occurred.

from purchases-flutter.

stnguyen90 avatar stnguyen90 commented on May 29, 2024

Is there any workaround for handling these pending payments? I am also running into this.

from purchases-flutter.

rkotzy avatar rkotzy commented on May 29, 2024

You should be able to detect a pending payment when it occurs through a specific purchase error, but there isn't an officially supported way to determine if there is a pending payment from the PurchaserInfo object.

We have this on the backlog, and would like to develop a solution that works cross-platform since there are pending purchases on iOS as well. Since this is really a backend API feature and not a specific Flutter SDK issue I'm going to close this out for now.

from purchases-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.