PayPal Payments, Checkout, but I don't receive the correct data in the answer.

ladysilvia
Contributor
Contributor

Paypal payments, checkouts, paypalcheckout. I must be able to receive data on success.php delete.php
Help me: I need to know when the product has been paid and then insert it in the MySQL or JSON dB

 
paypalCheckout.php

 

  <div id="paypal-button-container"></div>
  <div id="paypal-button"></div>
  <script src="https://www.paypalobjects.com/api/checkout.js"></script>
  <script>
    paypal.Button.render({

      env: '<?php echo PayPalENV; ?>', client: {
        <?php if(ProPayPal) { ?>
          production: '<?php echo PayPalClientId; ?>'
          <?php } else { ?>
            sandbox: '<?php echo PayPalClientId; ?>'
            <?php } ?>
          },
          // Customize button";
          style: {
            size: 'large',
            shape: 'pill',
            color: 'white',
            layout: 'horizontal',
            label: 'pay',
          },
          payment: function (data, actions) {
  	         return actions.payment.create({
               transactions: [{
                       amount: {
                            total: '<?php echo $productPrice; ?>',
        		             currency: '<?php echo $currency; ?>'
                       }
                     }]
                   });
                 },
                 onAuthorize: function (data, actions) {
                   return actions.payment.execute()
                   .then(function () {
                     window.location = "<?php echo PayPalBaseUrl ?>orderDetails.php?paymentID="+data.paymentID+"&payerID="+data.payerID+"&token="+data.paymentToken+"&pid=<?php echo $productId; ?>";
                   });
                 }
               }, '#paypal-button');
    </script>

 

 

 

 

I have to create success.php or cancel.php but I don't get data from paypal, who helps me with a functioning example?
Thank you
Lady

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.