Last active
November 6, 2018 23:40
-
-
Save bluepnume/892e4dc17a026f71358800285dd68236 to your computer and use it in GitHub Desktop.
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
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