react-native-in-app-utils icon indicating copy to clipboard operation
react-native-in-app-utils copied to clipboard

Couldn't receive callback from postponed transaction.

Open joyeon opened this issue 9 years ago • 7 comments
trafficstars

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 avatar Mar 11 '16 20:03 joyeon

@joyeon Does apple post two events one SKPaymentTransactionStateFailed and something else later after verification?

chirag04 avatar Mar 11 '16 21:03 chirag04

Yes apple ask to let user purchase again after verification. If the user accept it, apple post an event SKPaymentTransactionStatePurchased.

joyeon avatar Mar 11 '16 21:03 joyeon

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?

chirag04 avatar Mar 11 '16 21:03 chirag04

Will try to send PR but It could take time. If you want to patch it immediately please do it without hesitation.

joyeon avatar Mar 11 '16 22:03 joyeon

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.

mcrowe avatar Mar 09 '17 17:03 mcrowe

This is related to #31

mcrowe avatar Mar 14 '17 17:03 mcrowe

Any news on this? I'm having the same issue

lefoy avatar Nov 22 '17 13:11 lefoy