Last active
December 31, 2015 02:09
-
-
Save fastfrwrd/7918769 to your computer and use it in GitHub Desktop.
Basic QuickDonate setup.
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
(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 |
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
<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