PDT automatic return url non work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Migrate from Adaptive Payments to Commerce Platform in REST APIs
- Paypal Popout checkout in REST APIs
- check out integration problem please help in PayPal Payments Standard
- PayPal Sandbox Not Working Anymore in Sandbox Environment
- Permission denied with advanced hosted fields checkout in Sandbox Environment