[英]in-app billing with phonegap for android app
我正在開發一個android phonegap應用程序,我想在其中使用應用程序計費。 我安裝了phonegap計費插件 ,它運行完美。 您能否通過鏈接幫助我使其正常運行。
例如,下面是腳本代碼:
<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>
也就是說,在單擊鏈接后,首先可以在鏈接到頁面之前進行付款。 謝謝。 對不起,我的英語不好。
我不確定我明白你想要什么,你的英語比我的英語差。 但是,如果您只想在單擊時進行購物,然后在重定向后使用,則可以使用onclick事件和window.location.replace:
<a href="good.html" id='good' data-ignore="true" onclick="buy()" >Good</a>
// Click on purchase button
function buy(){
// make the purchase
inappbilling.buy(successHandler, errorHandler, "good_id");
return false;
}
然后添加window.location.replace('yourlinkpage'); 在您的successHandler上
但是也許輸入提交應該更合適?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.