我接入的是订阅内购,所以是非消耗型,支付完之后调用确认交易方法,调用doAcknowledgePurchase返回{"data":"data error","code":400}。 调用doConsume返回{"data":"","code":200}。
交易并没有确认,所以谷歌账号邮箱收到了邮件内容:
此测试购买交易未得到确认,因此已取消。为避免发生退款,您应确保所有购买交易均得到确认。如需了解详情,请参阅 https://developer.android.com/google/play/billing/integrate#process。
gooderself (作者)
调用了下面确认交易方法,返回400:
doAcknowledgePurchase() {
let that = this;
console.log('do pay function.');
if (that.payList == null || that.payList.length == 0) {
that.showToast('支付信息不能为空');
return;
}
googlePay.doAcknowledgePurchase(that.payList[0], e => {
console.log('acknowledgePurchase结果:', e);
that.showToast('acknowledgePurchase结果:' + JSON.stringify(e));
if (e.code == 200) {
console.log('acknowledgePurchase成功');
} else {
console.log('acknowledgePurchase失败');
}
});
}
2023-07-19 13:31