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

Interrupted transaction fails

Open chetstone opened this issue 9 years ago • 2 comments
trafficstars

Apple's guidelines suggest testing an interrupted transaction. When following that procedure, the transaction does not complete. When the app starts up again and this component is loaded, it adds the transaction observer and StoreKit immediately tries to complete the transaction but at this point there is no callback so it fails with No callback registered for transaction with state purchased.

All is not lost however, because the user could attempt the purchase again and if she agrees to the purchase, StoreKit comes back with You've already purchased this item, would you like to restore it for free? But not too intuitive to have to agree to purchase first.

I guess a workaround would be to add a restore purchases button... I didn't think my app would need it because once the purchase is complete the user is able to register for an account and uses that to log in in the future. Guess it's needed for this edge case.

I wonder if there's a way this component could be modified to have an appropriate callback registered at startup?

chetstone avatar Jul 08 '16 00:07 chetstone

I see the problem here and one more reason to move away from callback pattern to an event emitter pattern. I don't an immediate solution tho.

Btw, apple rejects app that does not have a restore purchase button.

chirag04 avatar Jul 08 '16 02:07 chirag04

Could you say more about what you mean by an event emitter pattern? Do you mean something like NetInfo, where you subscribe to changes, and have a method for initial value?

I don't think that would help this case, because by the time your JavaScript code is initialized, you've still missed queue events.

I think what's needed here is, instead of starting up the Queue listener in Objective-C init code, you wait and explicitly start it in ComponentDidMount of your root component or the constructor of a flux store. Then the callback model would still work --- you just pass a function that will handle any transaction coming in.

On Thu, Jul 7, 2016 at 20:11 Chirag [email protected] wrote:

I see the problem here and one more reason to move away from callback pattern to an event emitter pattern. I don't an immediate solution tho.

Btw, apple rejects app that does not have a restore purchase button.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chirag04/react-native-in-app-utils/issues/31#issuecomment-231258729, or mute the thread https://github.com/notifications/unsubscribe/AA7l178Yw2CEqLmNPPE1Ud2daOUfVrS-ks5qTbG5gaJpZM4JHoeU .

chetstone avatar Jul 08 '16 16:07 chetstone