Skip to content

Instantly share code, notes, and snippets.

@fastfrwrd
Last active December 31, 2015 02:09
Show Gist options
  • Save fastfrwrd/7918769 to your computer and use it in GitHub Desktop.
Save fastfrwrd/7918769 to your computer and use it in GitHub Desktop.
Basic QuickDonate setup.
(this will prepopulate the email and amount fields.)
http://yourdomain.com/yourpage?oneid-donate-email=<USER_EMAIL>&oneid-donate-amount=<DONATION_AMOUNT>&oneid-autorun=true
<script src="//api.oneid.com/js/oneid.js"></script>
<script>
// your QuickDonate implementation
var quickdonate = function() {
OneID.donate(function(response) {
if(response) {
// completed successfully. you'll have access to response.result.order here, which
// includes the users email and all personal info they input except for their CC info
} else {
// user cancelled
}
});
};
OneID.config({
// Merchant ID which you get from merchant.oneid.com
merchant_id: "MERCHANT-ID-HERE",
// if you include oneid-autorun=true in the URL vars,
// this function will be called when page loads
autorun: quickdonate
});
// when element is clicked, launch OneID QuickDonate
$(".quickdonate").on("click", quickdonate);
// you can also call your quickdonate on page load if a URL arg is set,
// if they land on a certain page... whatever.
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment