-
-
Save dredlong/e5e44838e653a84a3cd896d9c1e048b8 to your computer and use it in GitHub Desktop.
Voluum (callback example)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Rocketship checkout</title> | |
</head> | |
<body> | |
<div id="tracker"></div> | |
<div class="container"> | |
<h1>Rocketship checkout</h1> | |
<p>Grab your copy of Rocketship app</p> | |
<a id="buy-button" class="btn btn-default buy-button">Buy Now!</a> | |
</div> | |
<script src="https://cdn.paddle.com/paddle/paddle.js"></script> | |
<script type="text/javascript"> | |
Paddle.Setup({ | |
vendor: 12345, // Your Paddle vendor ID | |
}); | |
document.getElementById('buy-button').addEventListener('click', openCheckout, false); | |
function openCheckout () { | |
Paddle.Checkout.open({ | |
product: 654321, // Your product or plan ID | |
successCallback: track_conversion | |
}); | |
} | |
function track_conversion(data) { | |
var order_amount = (data.checkout.prices.vendor.total - data.checkout.prices.vendor.total_tax).toFixed(2); | |
// Replace URL below with your tracking domain | |
var img_src = "https://your-tracking-domain.com/conversion.gif?payout=" + order_amount + "&txid=" + data.checkout.id; | |
document.getElementById('tracker').innerHTML = '<img src="' + img_src + '" height="1" width="1">'; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment