0

請包括: 我買的產品,但我不能買第二次。Cordova在應用程序購買錯誤Devextreme

我使用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); 
    }); 

回答

0

朋友可以解決這個問題,不同的插件:

插件:

Cordova plugin add cordova-plugin-inapppurchase 

的manifest.json

{ "play_store_key": "YOUR PLAY STORE KEY" } 

大號oadProducs功能

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