We have integrated Paypal with our application and everything is working perfectly. But after the transaction is completed and successful we need that it should redirect to our application again. But its not happening. We have turned on the auto return option in the paypal too but its still not working.

Please help me out.

Dani AI

Generated

already enabled Auto Return, and replies from and touched the UI side (opening PayPal in a new window and specifying a return address). Those client-side controls affect user flow but do not guarantee a reliable, server-side confirmation of payment. The robust approach is to combine an immediate redirect flow for the buyer (PDT) with an asynchronous server-to-server notification (IPN). PDT gives transaction data on the return page; IPN is the authoritative way to update the database regardless of how the buyer closes the browser.

A minimal PDT workflow in PHP (illustrates verification only):

// get 'tx' from PayPal redirect
$tx = $_GET['tx'];
$auth_token = 'IDENTITY_TOKEN_FROM_PAYPAL';
$req = 'cmd=_notify-synch&tx=' . urlencode($tx) . '&at=' . urlencode($auth_token);

$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
$res = curl_exec($ch);
curl_close($ch);

if (strpos($res, "SUCCESS") === 0) {
    // parse key/value lines after SUCCESS and use those values to confirm payment
} else {
    // PDT failed: treat as unverified
}

Troubleshooting checklist and common pitfalls: enable PDT in the PayPal account to get an identity token; run tests in the Sandbox endpoint; do not rely on PHP session variables on the return page (the redirect is a new request); log every PayPal response and HTTP errors; use IPN (notify_url) as the system of record so delayed payments (eChecks) or closed-browser scenarios are handled; ensure the return/IPN URLs are public (not localhost) and reachable by PayPal; watch for popup blockers if opening PayPal in a separate window — that changes UX but not server confirmation.

IPN should be used to update orders in the database; PDT is for immediate UX and display. Combining both covers most failure modes and prevents lost payments when redirects do not occur.

Recommended Answers

All 2 Replies

We have integrated Paypal with our application and everything is working perfectly. But after the transaction is completed and successful we need that it should redirect to our application again. But its not happening. We have turned on the auto return option in the paypal too but its still not working.

Please help me out.

Hi...i dont know the exact solution to this..
we have one method to phase this situation what i know...u need to give target is blank in form posting...by using this we can create new window for paypal.....

<form name="aaa" target="_blank">

in your paypal form, set the input with the name of "return" to the address of your site. it needs to include the http://

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.