这是我的HTML代码
<html>
<head>
<script type="text/javascript" charset="utf-8">
function testInapp(){
console.log("Inside in app");
inAppPurchase.getProducts(['myapp.xyz']).then(function(products){
console.log(products);
}).catch(function(error){
console.log(error);
});
var restorePurchases = function(){
inAppPurchase.restorePurchases().then(function(data){
if(data.productId === 'myapp.xyz'){
}else if(data.productId === 'myapp.xyze'){
}
}).catch(function(error){
console.log(error);
});
};
var purchase = function(productId){
inAppPurchase.buy(productId).then(function(data){
if(data.productId=== 'myapp.xyz'){
}else if(data.productId === 'myapp.xyzs'){
}
purchases
return inAppPurchase.consume(data.type, data.receipt, data.signature);
}).catch(function(error){
console.log(error);
});
};
}
</script>
</head>
<body>
<input type="button" value="IN-APP" onclick="testInapp()"/>
</body>
</html>
点击按钮m调用testInapp()函数,其中包含应用程序内购买代码但是我得到inAppPurchase is not defined
这是我正在使用的插件https://github.com/AlexDisler/cordova-plugin-inapppurchase
任何人都可以帮我找出我做错的地方