iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
320 stars 21 forks source link

feature request: execute callback when android is done processing payment #22

Closed Robert-van-Barlingen closed 4 years ago

Robert-van-Barlingen commented 4 years ago

On android, when you initiate the IapHub.buy() function, it shows the google play purchase UI. When the payment in finished processing in the google play purchase UI is still takes some time before the buy() Promise is resolved. (I assume it verifies the purchase receipt during this time.) However, as soon as the google play purchase UI is closed I would like to show an element letting the user know that his payment is being processed further. Would it be possible to pass a callback to the buy() function that is executed as soon as the google play purchase UI closes?

iaphub commented 4 years ago

Correct @Astrejoe, this is an interesting option to add, we'll take a look at it.

iaphub commented 4 years ago

The onReceiptProcess option has been added in the latest release 🙂

var transaction = await Iaphub.buy("pack10_tier15", {
    onReceiptProcess: (receipt) => {
      console.log('Purchase success, processing receipt...');
    }
});