Skip to main content

One post tagged with "onDeferredPurchase"

View All Tags

· 2 min read

We're happy to announce the release the version 8.3 of the React Native plugin.
This new release is shipping some really helpful features!

What's new?

A new onDeferredPurchase event

Thanks to this event you'll now be able to easily detect when a new purchase occurs outside of the buy method.
For instance this event can be trigerred:

  • After a purchase is made outside the app (by redeeming a promo code on the store by example)
  • After a deferred payment (when the error code 'deferred_payment' is returned by the buy method)
  • After a payment fails because it couldn't be validated by IAPHUB (and succeeds later)
  var listener = Iaphub.addEventListener('onDeferredPurchase', async (transaction) => {

});

The enhancement of the restore method

The restore method will now return a RestoreResponse object.
This object will contain two properties:

  • newPurchases: The new purchases processed during the restore
  • transferredActiveProducts: The active products transferred (from another user) during the restore
var response = await Iaphub.restore();
// New purchases
console.log('New purchases: ', response.newPurchases);
// Extisting active products transferred to the user
console.log('Transferred active products: ', response.transferredActiveProducts);

New properties for the ActiveProduct object

We've also added a few extra properties for the active products.

  • isPromo
  • promoCode
  • originalPurchase

Enjoy!