Hi all,
I integreted InAppurchase 2 plugin on my ionic 5 app.
constructor(
private platform: Platform,
private inAppPurchase: InAppPurchase2
) {
this.platform.ready().then(() => {
console.debug("InApp Purchase Regisration")
this.inAppPurchase.DEBUG;
this.refreshAppProducts();
});
}
private refreshAppProducts() {
this.productIDs.forEach(productId => {
console.debug("In App Product Registration: " + productId)
this.inAppPurchase.register({
id: productId,
type: this.inAppPurchase.NON_CONSUMABLE,
alias: productId
});
this.subscribeNotifications(productId);
});
this.inAppPurchase.refresh();
}
public order(productId) {
this.inAppPurchase.order(productId);
}
private subscribeNotifications(productId) {
this.inAppPurchase.when(productId).registered((product: IAPProduct) => {
console.log('Registered: ' + JSON.stringify(product));
alert ('Registered: ' + JSON.stringify(product));
});
// Updated
this.inAppPurchase.when(productId).updated((product: IAPProduct) => {
console.log('Updated' + JSON.stringify(product));
});
// User closed the native purchase dialog
this.inAppPurchase.when(productId).cancelled((product) => {
console.error('Purchase was Cancelled');
alert('Purchase was Cancelled');
});
// Track all store errors
this.inAppPurchase.error((err) => {
console.error('Store Error ' + JSON.stringify(err));
alert ('Store Error ' + JSON.stringify(err));
});
}
After initialization, when I try to open order, the error handler is triggered and I receive this error:
Store Error {"code":6777003...
I tried on real android device using this command:
ionic cordova run android --device -l -c --debug
I already created product on my android google console.
Help me please
Luca