Skip to content

Instantly share code, notes, and snippets.

@bluepnume
Last active November 6, 2018 23:40
Show Gist options
  • Save bluepnume/892e4dc17a026f71358800285dd68236 to your computer and use it in GitHub Desktop.
Save bluepnume/892e4dc17a026f71358800285dd68236 to your computer and use it in GitHub Desktop.
paypal.Button.render({
payment: function(resolve) {
getPayPalToken(function(token) {
resolve(token);
});
},
onAuthorize: function(data) {
getPayPalTokenDetails(data.paymentToken, data.function(details) {
console.log(details)
});
}
}, '#container');
function getPayPalToken(callback) {
jquery.ajax({
url: '...',
success: function(data) {
callback(data.paypalToken);
}
})
}
function getPayPalTokenDetails(token, callback) {
jquery.ajax({
url: '...?token=' + token,
success: function(data) {
callback(data);
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment