Created
September 6, 2016 21:15
-
-
Save bluepnume/1dbdd0395fe4bc833df36290dee70dd0 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
| <!DOCTYPE html> | |
| <head> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| </head> | |
| <script src="https://code.jquery.com/jquery-1.12.4.js"></script> | |
| <script src="https://www.paypalobjects.com/api/button.js"></script> | |
| <script src="./dist/paypal.checkout.v4.js" data-env="production" data-paypal-checkout></script> | |
| <div id="checkoutButtonContainer"></div> | |
| <script> | |
| (function() { | |
| // Create a button and render to the page (eventually there will be a ppxo.PayPalButton component for this, to complement ppxo.PayPalCheckout) | |
| var checkoutButton = window.paypal.button.create('merchantID', { | |
| lc: 'en_US', | |
| color: 'blue', | |
| shape: 'pill', | |
| size: 'medium' | |
| }, { | |
| label: 'checkout', | |
| type: 'button' | |
| }); | |
| document.getElementById('checkoutButtonContainer').appendChild(checkoutButton.el); | |
| // ------------------------- | |
| checkoutButton.el.addEventListener('click', function() { | |
| ppxo.Checkout.render({ | |
| clientID: { | |
| local: 'alc_client1', | |
| sandbox: 'AWi18rxt26-hrueMoPZ0tpGEOJnNT4QkiMQst9pYgaQNAfS1FLFxkxQuiaqRBj1vV5PmgHX_jA_c1ncL', | |
| production: 'Aco85QiB9jk8Q3GdsidqKVCXuPAAVbnqm0agscHCL2-K2Lu2L6MxDU2AwTZa-ALMn_N0z-s2MXKJBxqJ' | |
| }, | |
| paymentDetails: { | |
| transactions: [ | |
| { | |
| amount: { | |
| total: '1.00', | |
| currency: 'USD' | |
| } | |
| } | |
| ] | |
| }, | |
| onPaymentAuthorize: function(data) { | |
| console.warn('Payment authorized', data.paymentToken, data.payerID, data.returnUrl); | |
| }, | |
| onPaymentCancel: function(data) { | |
| console.error('Payment cancelled', data.paymentToken, data.cancelUrl); | |
| }, | |
| onError: function(err) { | |
| console.error('Component error:', err.stack); | |
| } | |
| }); | |
| }); | |
| })(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment