AndroidInAppBilling
AndroidInAppBilling copied to clipboard
working with a links
I am developing an android phonegap application and I want to use in app billing in it. I installed the phonegap billing plugin and it works perfectly. Can anyone help me make it work correct with a links for example:
<a href="good.html" id='good' data-ignore="true">Good</a>
Thats after clicking on a link first of all i ll be able to pay or check if a good is already bought before linking to a page. Thanks.
You'll need to use JavaScript to capture the link click event and then wait for the plugin callback. It might look something like this (with jQuery):
function onSuccess() {
//link to your other page on success
document.location.href = 'your-link';
}
function onFail() {
//handle buying errors here
}
$('#good').click(function() {
inappbilling.buy(onSuccess, onFail, 'your-product-id');
});