【发布时间】:2014-05-15 13:49:05
【问题描述】:
我正在开发一个 android phonegap 应用程序,我想在其中使用应用程序计费。我安装了phonegap billing plugin,它运行良好。你能帮我用一个链接让它正常工作吗?
例如,这里是脚本代码:
<script >
function successHandler (result) {
var strResult = "";
if(typeof result === 'object') {
strResult = JSON.stringify(result);
} else {
strResult = result;
}
alert("SUCCESS: \r\n"+strResult );
}
function errorHandler (error) {
alert("ERROR: \r\n"+error );
}
// Click on init button
function init(){
// Initialize the billing plugin
inappbilling.init(successHandler, errorHandler, {showLog:true});
}
// Click on purchase button
function buy(){
// make the purchase
inappbilling.buy(successHandler, errorHandler, "good_id");
}
// Click on ownedProducts button
function ownedProducts(){
// Initialize the billing plugin
inappbilling.getPurchases(successHandler, errorHandler);
}
// Click on Consume purchase button
function consumePurchase(){
inappbilling.consumePurchase(successHandler, errorHandler, "good_id");
}
// Click on subscribe button
function subscribe(){
// make the purchase
inappbilling.subscribe(successHandler, errorHandler,"good_id");
}
// Click on Query Details button
function getDetails(){
// Query the store for the product details
inappbilling.getProductDetails(successHandler, errorHandler, "good_id");
}
// Click on Get Available Products button
function getAvailable(){
// Get the products available for purchase.
inappbilling.getAvailableProducts(successHandler, errorHandler);
}
</script>
例如,我需要它来工作 -
<a href="good.html" id='good' data-ignore="true">Good</a>
首先点击链接后,我将能够在链接到页面之前付款。 谢谢。对不起我的英语不好。
【问题讨论】:
标签: android cordova phonegap-plugins billing