PDT automatic return url non work

blackout69
Contributor
Contributor

Hello everybody,

i can't get auto return to work on a url.

On sandbox, I have enabled the automatic return, set my url and enabled the PDT.

When I simulate a transaction with a sandbox account, the payment goes through, but the script I wrote in my auto return url does not run.

Can anyone tell me where I'm wrong?

Thank you in advance

blackout69

Login to Me Too
2 REPLIES 2

blackout69
Contributor
Contributor

Hi everyone,

This is the code I use to execute the transaction.

 

function initPayPalButton() {
  paypal.Buttons({
    style: {
      shape: 'rect',
      color: 'gold',
      layout: 'vertical',
      label: 'paypal',

    },

    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{"description":"My Item","amount":{"currency_code":"EUR","value":10}}]
      });
    },

    onApprove: function(data, actions) {
      return actions.order.capture().then(function(orderData) {

        // Full available details
        console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
        var url = 'myscript.php;
        actions.redirect(url);
      });
    },

    onError: function(err) {
      console.log(err);
    }
  }).render('#paypal-button-container');
}

 

This is the code I use to execute the transaction. The redirect works, but I don't receive the transactionID (tx) value via GET.

As a php script I am using this: https://github.com/paypal/pdt-code-samples/blob/master/paypal_pdt.php 

How can I get the transactionID?

 

Login to Me Too

blackout69
Contributor
Contributor

Hello and thanks for the reply,

my problem is as follows:

When I simulate a transaction with a sandbox account, the payment goes through, but the script I wrote in my auto return url does not run. I'm not getting any error messages.

Except my script.php doesn't run at the end of the transaction

 

 

 

    onApprove: function(data, actions) {
      return actions.order.capture().then(function(orderData) {
        var transaction = orderData.purchase_units[0].payments.captures[0];
        actions.redirect('myscript.php?tx=' + transaction.id);
      });
    },

 

 

To force my script.php to run I had to create a javascript redirect.

So I solved my problem.

At this point I wonder what is the real usefulness allowed by paypal to be able to configure a return page?

Maybe just for the IPN?

Thanks for any answers 

Login to Me Too

Haven't Found your Answer?

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