Advertisement
Jonec300

Untitled

Mar 28th, 2023
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.57 KB | None | 0 0
  1. <div id="smart-button-container-2">
  2.       <div style="text-align: center;">
  3.         <div id="paypal-button-container-2"></div>
  4.       </div>
  5.     </div>
  6.   <script src="https://www.paypal.com/sdk/js?client-id=sb&enable-funding=venmo&currency=EUR" data-sdk-integration-source="button-factory"></script>
  7.   <script>
  8.     function initPayPalButton2() {
  9.       paypal.Buttons({
  10.         style: {
  11.           shape: 'pill',
  12.           color: 'gold',
  13.           layout: 'horizontal',
  14.           label: 'paypal',
  15.           tagline: true
  16.         },
  17.  
  18.         createOrder: function(data, actions) {
  19.           return actions.order.create({
  20.             purchase_units: [{"description":"lezione fotografica avanzata paesaggistica","amount":{"currency_code":"EUR","value":130}}]
  21.           });
  22.         },
  23.  
  24.         onApprove: function(data, actions) {
  25.           return actions.order.capture().then(function(orderData) {
  26.            
  27.             // Full available details
  28.             console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
  29.  
  30.             // Show a success message within this page, e.g.
  31.             const element = document.getElementById('paypal-button-container-2');
  32.             element.innerHTML = '';
  33.             element.innerHTML = '<h3>Thank you for your payment!</h3>';
  34.  
  35.             // Or go to another URL:  actions.redirect('thank_you.html');
  36.            
  37.           });
  38.         },
  39.  
  40.         onError: function(err) {
  41.           console.log(err);
  42.         }
  43.       }).render('#paypal-button-container-2');
  44.     }
  45.     initPayPalButton2();
  46.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement