Android in app purchase: Signature verification failed

后端 未结 14 814
说谎
说谎 2020-11-28 02:27

I have tried for several days to solve this problem, using the Dungeons demo code that comes with the SDK. I\'ve tried to Google for an answer but can\'t find one.

14条回答
  •  甜味超标
    2020-11-28 03:19

    For Cordova and Hybrid apps you need to use this.iap.subscribe(this.productId) method to subscription InAppPurchase.

    Following are the code working fine for me:

     getProdutIAP() {
            this.navCtrl.push('subscribeDialogPage');
            this.iap
                .getProducts(['productID1']).then((products: any) => {
                    this.buy(products);
                })
                .catch((err) => {
                    console.log(JSON.stringify(err));
                    alert('Finished Purchase' + JSON.stringify(err));
                    console.log(err);
                });
        }
    
        buy(products: any) {
            // this.getProdutIAP();
            // alert(products[0].productId);
            this.iap.subscribe(products[0].productId).then((buydata: any) => {
                alert('buy Purchase' + JSON.stringify(buydata));
                // this.sub();
            }).catch((err) => {
                // this.navCtrl.push('subscribeDialogPage');
                alert('buyError' + JSON.stringify(err));
            });
        }
    
        sub() {
            this.platform.ready().then(() => {
                this.iap
                    .subscribe(this.productId)
                    .then((data) => {
                        console.log('subscribe Purchase' + JSON.stringify(data));
                        alert('subscribe Purchase' + JSON.stringify(data));
                        this.getReceipt();
                    }).catch((err) => {
                        this.getReceipt();
                        alert('subscribeError' + JSON.stringify(err));
                        console.log(err);
                    });
            })
        }
    

提交回复
热议问题