React-native-iap: App start flow question

Created on 25 Aug 2019  路  2Comments  路  Source: dooboolab/react-native-iap

Using react-native-iap V3 can I lose some store purchase callbacks, if initConnection() and purchaseUpdatedListener() will be launched later, not in the main app container componentDidMount?

For example, my app will show user some animation on app start, then send request and wait answer from my server, and only then will be able to correct processing product purchasing by listener. Therefore, I would like to receive a message from the store later. Is it not too late to init and register a listener for belated callbacks from the store that may come at the start of the application?

Most helpful comment

Thanks.
I have tested it. Late initConnection() + purchaseUpdatedListener() still work well and successfully receive events in a new session from a previous session.

All 2 comments

@iLyxa3D if everything works as intended it should never be too late to initialize the listener. When you register your first listener you should receive the status for all pending purchases at that time. Be sure to set andDangerouslyFinishTransactionAutomatically to false and finish purchases yourself though. If you don't you always run the risk of missing callbacks.

Thanks.
I have tested it. Late initConnection() + purchaseUpdatedListener() still work well and successfully receive events in a new session from a previous session.

Was this page helpful?
0 / 5 - 0 ratings