chirag04 / react-native-in-app-utils

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

restorePurchases doesn't work #148

Closed tirrorex closed 6 years ago

tirrorex commented 6 years ago

Pretty straightforward code :

getPurchasedProducts(products) { return new Promise(function (resolve, reject) { InAppUtils.restorePurchases((error, response) => { if (error !== undefined) { console.warn("error restore"); reject(error); } else if (response.length === 0) { console.warn("no products to restore"); resolve(products); } else { console.warn("restoring purchases"); response.forEach((purchase) => { const product = products.find((product) => product.id === purchase.identifier); if (product !== undefined) { product.purchased = true; } }); resolve(products); } }); }); }

Got error restore on sandbox even though i just purchased the product (didn't reload the app), this is non-consumable IAP so i shouldn't have any issue. Any idea on how to debug this ?

tirrorex commented 6 years ago

ok so i did some checking, there is indeed a response with the purchase but also an error who is set. Weird, did i miss something ?

tirrorex commented 6 years ago

Ok so the error passed is null but not undefined. My bad