chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
890 stars 185 forks source link

Support a callback on subscription renewal #108

Closed akshetpandey closed 1 month ago

akshetpandey commented 7 years ago

Before this change, the callback would have come before the JS would have had a time to initialize, this change makes it so that once the JS is initialized, the app can request for SKPayment events.

Anyone who wants to use this, will need add some code like and then call _setQueuedPurchaseHandler once they are ready to start accepting SKPayment events. Existing behavior doesn't change.

_setQueuedPurchaseHandler () {
  InAppUtils.setQueuedPurchaseHandler((error, response) => {
    try {
      // Handle error/response
    } finally {
      _setQueuedPurchaseHandler()
    }
}