我正在尝试将应用内购买与(cordova plugin add cordova-plugin-inapppurchase)集成到我的应用中,但不幸的是遇到了这个恼人的错误“您请求的项目不可购买”。我已经完成了所有这些工作:
1.签署发布的as,开发者控制台和设备账号上的版本相同,开发者控制台上列出的是测试用的,和我的不一样。
2.开发者控制台上的产品处于活动状态。
但它仍然显示不能购买。
发布于 2016-08-24 19:55:07
*添加安卓计费密钥*
应用内计费的许可证密钥应手动添加到您的项目中。此密钥位于Google Play开发人员控制台的服务和API中。
许可证密钥在安装过程中设置:
cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="MIIB...AQAB"
Replace MIIB...AQAB with your own android license key.要更改它,请删除该插件,然后使用新密钥重新添加它。**
在安卓系统上创建新产品
从开发人员控制台添加应用内购买项目,激活它们无需发布应用程序。购买类型:
对于消耗性订阅、非消耗性订阅和非续订订阅,请选择“托管”。对于免费订阅和付费订阅,请选择“订阅”。
发布于 2016-08-24 20:52:36
这是控制器,它正确地获取了物品的详细信息价格,但当我购买任何物品时,它会给出错误(您请求的物品不可购买)
var productIds =‘com.ionicframework.*7.producTone’,‘com.ionicframework.*7.productTwo’;// var spinner =‘
';
$scope.loadProducts = function () { $ionicLoading.show({ template:$ionicLoading.show+‘加载产品...’});inAppPurchase .getProducts(productIds) .then(function (products) { $ionicLoading.hide();$scope.products = products;}) .catch(function (err) { $ionicLoading.hide();console.log(err);});};
$scope.buy =函数(productId) {
$ionicLoading.show({ template: spinner + 'Purchasing...' });
inAppPurchase
.buy(productId)
.then(function (data) {
console.log(JSON.stringify(data));
console.log('consuming transactionId: ' + data.transactionId);
return inAppPurchase.consume(data.type, data.receipt, data.signature);
})
.then(function () {
var alertPopup = $ionicPopup.alert({
title: 'Purchase was successful!',
template: 'Check your console log for the transaction data'
});
alert('consume done!');
$ionicLoading.hide();
})
.catch(function (err) {
$ionicLoading.hide();
[enter image description here][1]
$ionicPopup.alert({
title: 'Something went wrong',
template: JSON.stringify(err)
});
});};
$scope.restore = function () { $ionicLoading.show({ template: spinner +‘恢复购买...’});inAppPurchase .restorePurchases() .then(function (购买){ $ionicLoading.hide();
$ionicPopup.alert({
title: 'Restore was successful!',
template: 'Check your console log for the restored purchases data'
});
})
.catch(function (err) {
$ionicLoading.hide();
$ionicPopup.alert({
title: 'Something went wrong',
template: JSON.stringify(err)
});
});};
https://stackoverflow.com/questions/39121753
复制相似问题