Explore Our Services

paypal

by | Dec 9, 2022 | Uncategorized


x
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
  <!-- Replace "test" with your own sandbox Business account app client ID -->
  <script src="https://www.paypal.com/sdk/js?client-id=darren@adco.biz&currency=USD"></script>
  <!-- Set up a container element for the button -->
  <div id="paypal-button-container"></div>
  <script>
    paypal.Buttons({
      // Sets up the transaction when a payment button is clicked
      createOrder: (data, actions) => {
        return actions.order.create({
          purchase_units: [{
            amount: {
              value: '77.44' // Can also reference a variable or function
            }
          }]
        });
      },
      // Finalize the transaction after payer approval
      onApprove: (data, actions) => {
        return actions.order.capture().then(function(orderData) {
          // Successful capture! For dev/demo purposes:
          console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
          const transaction = orderData.purchase_units[0].payments.captures[0];
          alert(`Transaction ${transaction.status}: ${transaction.id}\n\nSee console for all available details`);
          // When ready to go live, remove the alert and show a success message within this page. For example:
          // const element = document.getElementById('paypal-button-container');
          // element.innerHTML = '<h3>Thank you for your payment!</h3>';
          // Or go to another URL:  actions.redirect('thank_you.html');
        });
      }
    }).render('#paypal-button-container');
  </script>
</body>
</html>

Written By darren thomas

Written by Jane Doe, Lead Designer at Adco Design – eLearning

Related Posts

https://adcodesign.com/page-4/ page 4

[et_pb_wc_cart_notice _builder_version="4.6.6" _module_preset="default" body_font="Montserrat||||||||" body_text_color="#252630" body_line_height="2em" background_color="rgba(0,0,0,0)" custom_button="on" button_text_size="12px" button_text_color="#ffffff"...

read more

https://adcodesign.com/198-2/

[et_pb_wc_cart_notice _builder_version="4.7.1" _module_preset="default" custom_button="on" button_text_size="12px" button_text_color="#ffffff" button_bg_color="#000645" button_border_radius="6px" button_letter_spacing="1px" button_font="Rubik|500||on|||||"...

read more

https://adcodesign.com/home/ Home

Help Us Save Our Beautiful Planet   For All of Us Mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec rutrum congue...

read more

0 Comments