I have linked up an in-app purchase (a non_consumable) and I received a "Payment Successful" with a "how often would you like to confirm your password for purchase" alert box.

However, after the success, I received this error messages. Am I receiving these messages because I'm testing it in Alpha with test accounts? Can't seem to find documentation for these 2 errors.

Store Error {"code": 6777017,"message":" Purchase Failed: Error Purchasing: labResult: Signature verification Failed for sku com.app.Jumphop.quiz (response:6777017: Error)"}

Store Error {"code":7,"message":" Purchase failed: Error Purchasing: labResult: Unable to buy item (response: 7:Error)"}

EDIT: I'm using this code base https://github.com/thielCole/ionic-iap2 .... Here is the code the IAP is handling...

export class AboutPage implements OnInit {

public product: any = {

name: 'My Product',

appleProductId: '1234',

googleProductId: 'com.38plank.spartan_one'

};

constructor(public navCtrl: NavController,

private store: InAppPurchase2,

public platform: Platform) {

}

ngOnInit() {

this.configurePurchasing();

}

configurePurchasing() {

if (!this.platform.is('cordova')) { return; }

let productId;

try {

if (this.platform.is('ios')) {

productId = this.product.appleProductId;

} else if (this.platform.is('android')) {

productId = this.product.googleProductId;

}

// Register Product

// Set Debug High

this.store.verbosity = this.store.DEBUG;

// Register the product with the store

this.store.register({

id: productId,

alias: productId,

type: this.store.NON_RENEWING_SUBSCRIPTION

});

this.registerHandlers(productId);

this.store.ready().then((status) => {

console.log(JSON.stringify(this.store.get(productId)));

console.log('Store is Ready: ' + JSON.stringify(status));

console.log('Products: ' + JSON.stringify(this.store.products));

});

// Errors On The Specific Product

this.store.when(productId).error( (error) => {

alert('An Error Occured' + JSON.stringify(error));

});

// Refresh Always

console.log('Refresh Store');

this.store.refresh();

} catch (err) {

console.log('Error On Store Issues' + JSON.stringify(err));

}

}

registerHandlers(productId) {

// Handlers

this.store.when(productId).approved( (product: IAPProduct) => {

// Purchase was approved

product.finish();

});

this.store.when(productId).registered( (product: IAPProduct) => {

console.log('Registered: ' + JSON.stringify(product));

});

this.store.when(productId).updated( (product: IAPProduct) => {

console.log('Loaded' + JSON.stringify(product));

});

this.store.when(productId).cancelled( (product) => {

alert('Purchase was Cancelled');

});

// Overall Store Error

this.store.error( (err) => {

alert('Store Error ' + JSON.stringify(err));

});

}

async purchase() {

/* Only configuring purchase when you want to buy, because when you configure a purchase

It prompts the user to input their apple id info on config which is annoying */

if (!this.platform.is('cordova')) { return };

let productId;

if (this.platform.is('ios')) {

productId = this.product.appleProductId;

} else if (this.platform.is('android')) {

productId = this.product.googleProductId;

}

console.log('Products: ' + JSON.stringify(this.store.products));

console.log('Ordering From Store: ' + productId);

try {

let product = this.store.get(productId);

console.log('Product Info: ' + JSON.stringify(product));

let order = await this.store.order(productId);

alert('Finished Purchase');

} catch (err) {

console.log('Error Ordering ' + JSON.stringify(err));

}

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐