Created
May 1, 2022 08:49
-
-
Save swashata/4a45c7eecb91c0d27ae8246239a69fd4 to your computer and use it in GitHub Desktop.
Separate Lifetime & Annual Buy Button Freemius
This file contains hidden or 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> | |
<body> | |
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> | |
<script src="https://checkout.freemius.com/checkout.min.js"></script> | |
<button id="purchase_lifetime">Buy Lifetime License</button> | |
<button id="purchase_annual">Buy Annual License</button> | |
<script type="text/javascript"> | |
const handler = FS.Checkout.configure({ | |
plugin_id: 'XXX', // replace with plugin_id | |
plan_id: 'XXX', // replace with plan_id | |
public_key: 'pk_xxxxxx', // replace with public_key | |
image: 'https://your-plugin-site.com/logo-100x100.png', // replace with image | |
}); | |
// Open prompt with billing_cycle set to 'lifetime' for Lifetime purchase. | |
document.querySelector('#purchase_lifetime').addEventListener('click', e => { | |
e.preventDefault(); | |
handler.open({ | |
name: 'Your Plugin Name', | |
billing_cycle: 'unlimited', | |
// ... other needed configs | |
}); | |
}); | |
// Open prompt with billing_cycle set to 'annual' for Annual billing cycles. | |
document.querySelector('#purchase_annual').addEventListener('click', e => { | |
e.preventDefault(); | |
handler.open({ | |
name: 'Your Plugin Name', | |
billing_cycle: 'annual', | |
// ... other needed configs | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment