Last active
February 28, 2017 00:28
-
-
Save chrissrogers/271c874be110d48b08b6f40eb12f3aca 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
| // If using PayPal through Braintree, instantiate the PayPal class as follows | |
| var paypal = recurly.PayPal({ braintree: { clientAuthorization: MY_CLIENT_AUTHORIZATION_CODE } }); | |
| // handle errors | |
| paypal.on('error', function (err) { | |
| // err.code | |
| // err.message | |
| // [err.error] | |
| }); | |
| // the token handler is called when the payment flow is complete. Use this token to create a BillingInfo via the API | |
| paypal.on('token', function (token) { | |
| // token.id | |
| }); | |
| // the start function must be called within a user-initiated event like 'click' or 'touchend' | |
| $('#paypal-button').on('click', function () { | |
| paypal.start(); | |
| }); |
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
| // Normal PayPal flow | |
| var paypal = recurly.PayPal(); | |
| // handle errors | |
| paypal.on('error', function (err) { | |
| // err.code | |
| // err.message | |
| }); | |
| // the token handler is called when the payment flow is complete. Use this token to create a BillingInfo via the API | |
| paypal.on('token', function (token) { | |
| // token.id | |
| }); | |
| // the start function must be called within a user-initiated event like 'click' or 'touchend' | |
| $('#paypal-button').on('click', function () { | |
| paypal.start({ description: 'Monthly Subscription' }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment