Cordova在应用程序购买错误Devextreme

时间:2017-03-23 14:25:48

标签: 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(function (err) {
    alert("Başarısız! "+ err);
  });

1 个答案:

答案 0 :(得分:0)

朋友可以使用其他插件解决此问题:

插件:

   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);
       });