react-native-in-app-utils
react-native-in-app-utils copied to clipboard
Couldn't receive callback from postponed transaction.
Hello there,
Thanks for this useful plugin!
I found a react-native app couldn't receive the callback properly when itunes store postpones a transaction because of some reason like user verification, but It asks ths user to purchase an item again after verification. Because when itunes store postpones a transaction, It drops SKPaymentTransactionStateFailed first and the native module remove the callback at that time.
I tried to remove callback only when the user cancels the transaction. But I'm not sure It is proper way.
Thanks,
@joyeon Does apple post two events one SKPaymentTransactionStateFailed and something else later after verification?
Yes apple ask to let user purchase again after verification. If the user accept it, apple post an event SKPaymentTransactionStatePurchased.
Interesting. Not sure what's the correct way to handle this. We should not leak callbacks when we get SKPaymentTransactionStateFailed.
Maybe it's time to move away from callback based pattern to an event based one. @joyeon you want to send a PR?
Will try to send PR but It could take time. If you want to patch it immediately please do it without hesitation.
I have been experiencing this same issue. I believe this is because this library is focused on a callback pattern, which only listens for transaction changes during the lifetime of that request. Best practices are to listen for transactions when the app launches so that postponed requests like this are seen. See Apple's description for more details.
This happens quite rarely, and I'm not sure how to recreate it deliberately. We get about 750 new subscriptions per month, and this seems to happen to about 1 user per month. Still, it leads to a pretty frustrating experience for that 1 user.
As @chirag04 suggests, I think the solution lies in moving towards an event-based architecture. I will be working on a solution imminently. I may provide a PR, or create a new library, depending on the extent of the changes needed.
This is related to #31
Any news on this? I'm having the same issue