cordova-plugin-purchase
cordova-plugin-purchase copied to clipboard
cordova-plugin-purchase store.when().approved event trigger multiple time.
I've integrated version 13.11.1 of the cordova-plugin-purchase into my Ionic application. Additionally, I've set up a consumable product in the Apple App Store and created a dedicated sandbox user for testing purposes. While I can successfully retrieve product details from the store and display them in the application template, I'm encountering an issue during the purchase process. when the purchase was successful store.when() was trigger but each time it will trigger one time more to the previous one. On first purchase it will trigger two time, on second purchase it will trigger three time even i was ensure that the function setupListeners() was call one time in entire app lifecycle then also it will trigger multiple time.
setupListeners() {
store.when()
.approved((p: any) => {
if (p.products[0].id === this.PRODUCT_GEMS_KEY)) {
this.gem.update(value => value + 100);
} else if (p.products.id === this.Comsumable_Plan) {
console.log('In Consumable paln')
}
p.verify();
})
.verified((p: any) => {
p.finish()
});
}
I really appreciate any help you can provide.