Devextreme上的Cordova应用程序内购买错误
请包括: 我买了这个产品,但我不能再买了 我使用devextreme 您的代码/复制步骤Devextreme上的Cordova应用程序内购买错误,cordova,in-app-purchase,cordova-plugins,android-inapp-purchase,Cordova,In App Purchase,Cordova Plugins,Android Inapp Purchase,请包括: 我买了这个产品,但我不能再买了 我使用devextreme 您的代码/复制步骤 inAppPurchase .buy(urunID) .then(function (data) { return inAppPurchase.consume(data.type, data.receipt, data.signature); }) .then(function () { alert("Satın alma Başarılı"); }) .catch
inAppPurchase
.buy(urunID)
.then(function (data) {
return inAppPurchase.consume(data.type, data.receipt, data.signature);
})
.then(function () {
alert("Satın alma Başarılı");
})
.catch(function (err) {
alert("Başarısız! "+ err);
});
朋友可以使用不同的插件解决此问题: 插件:
Cordova plugin add cordova-plugin-inapppurchase
Manifest.json
{ "play_store_key": "YOUR PLAY STORE KEY" }
LoadProducs函数
var productIds=['com.company.app.product1','com.company.app.product2'];
inAppPurchase
.getProducts(productIds)
.then(function (products) {
//products ok
})
.catch(function (err) {
console.log(err);
});
购买功能
var productId='com.company.app.product1';
inAppPurchase
.buy(productId)
.then(function (data) {
console.log(JSON.stringify(data));
// The consume() function should only be called after purchasing consumable products
// otherwise, you should skip this step
return inAppPurchase.consume(data.type, data.receipt, data.signature);
})
.then(function () {
console.log('consume done!');
//purchase ok
})
.catch(function (err) {
console.log(err);
});