-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update readme #486
update readme #486
Conversation
addAdditionalSuccessPurchaseListenerIOS needs to be called prior to buyProduct if one expects it to catch successful purchases
I haven't tested this but it looks like for a normal flow (not the StokeKit flow), |
@Edgpaez I partially agree with @vafada. You should only subscribe to the listener when there was a failure in the In addition, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my comment above and improve your code separately. If you want the better approach, please preserve the previous code then post other approaches below.
@vafada, yes. This is not related to storekit flow. TBH, I don't understand how to address your comment. @hyochan I don't think you can subscribe AFTER you get the error. Not if you want to be sure you'll catch the error. I think we need to be clear to users that |
@Edgpaez I am not sure what you are trying to achieve here. I think I've explained everything previously. |
What I'm trying to do is fix the documentation since I believe the example code has a bug. The bug (I believe) is that Current Implementation Inside So, what's the problem? The fix? I hope that's clearer @hyochan |
@Edgpaez Thanks for your through explanation and I could understand you much better! I've not yet reproduced any missing event in my other app. Also, the listener is registered when there was failure in the purchase as in line of code. I am not quite sure tough whether there will be any hole doing the implementation this way since this was just the work around described in #348. If there is any clear reproducible senario, I would like to try to consider this once again. |
@Edgpaez has a point. There is NO GUARANTEE that the listener would be added before the second success transaction comes to the queue. So this flow is possible:
At this point, the success transaction is now lost. |
@vafada The code goes to If we use the updated code, the listener will receive the |
We don't know how fast or slow StoreKit will put the success transaction in the queue. It's all async so it is not safe to assume that the success transaction will always come in after adding the listener. I agree also with the listener getting two event for the same successful transaction. This is not an easy problem 😄 I'm now using this fork https://github.com/superandrew213/react-native-in-app-utils/tree/listen-for-purchase-event#helpers And here's my pseudo code to deal with StoreKit flow: |
@hyochan IMHO it's better if users handle purchases more than once instead of having no guarantee that all successful purchases are handled. Since transactions have IDs users have data available to avoid duplicates on their end. I know it's not ideal but IMHO it's the best suggestion we can give users until we can come up with a better API that hides all these details. @vafada I'll take a look at your fork 👍 |
@Edgpaez If you'd like to support a better approach to the Thanks for all your support in advance. |
@vafada Since |
related to #423
addAdditionalSuccessPurchaseListenerIOS
needs to be called prior tobuyProduct
if one expects it to catch successful purchases.This PR reflects this on the example usage of
buyProduct