I have created a customised shopping cart coded in PHP. Once the user has filled their cart they hit checkout and all of the details, including the address detail, are posted into a PayPal shopping cart and the user can pay using a PayPal account or a credit card.

After the user has paid, PayPal re-directs (and here's the problem - see below) the user back a page on my site. This page conducts a brief to and fro with the PayPal server and, providing everything matches properly, a PDF invoice is emailed to the customer, a despatch note to the store guy and a copy invoice goes to the accounts office.

The problem: If the customer fails to return from the PayPal site then none of the order processing takes place. There are a few factors that may prevent the customer returning to the site and I need to factor this possibility in.

So, my question is, can someone tell me if I use the PayPal IPN system will it send a message to my web server 'listening' page even if the customer doesn't return to the site?

Thanks for your time,

Simon.

Dani AI

Generated

Short answer: yes — use PayPal IPN. IPN is a server-to-server (asynchronous) notification that PayPal posts to your listener regardless of whether the buyer returns to your site; PayPal will keep retrying delivery for several days if your listener does not acknowledge it. This is exactly the mechanism you want when the return redirect isn’t reliable. PayPal: Automate order management. (paypal.com)

What to implement (practical checklist for ): enable IPN or add notify_url on checkout, build an IPN listener that quickly returns HTTP 200, then verifies the IPN by POSTing the exact payload back to PayPal with cmd=_notify-validate and waiting for VERIFIED. Only after verification should the listener update order state (check payment_status == "Completed", receiver_email, mc_gross/currency and that the txn_id (or combination of fields) hasn’t already been processed). Keep the verification/ack response fast; do heavy DB work only after verification and logging. See the IPN integration steps. IPN integration/verification guide. (developer.paypal.com)

Minimal PHP sketch (do not block on long tasks; log, respond 200, then process):

$raw = file_get_contents('php://input');
$req = 'cmd=_notify-validate&'.$raw;
// post $req back to https://ipnpb.paypal.com/cgi-bin/webscr (sandbox: ipnpb.sandbox.paypal.com)
// check response == "VERIFIED" then validate fields and update DB idempotently

If you need the customer-facing instant confirmation (PDF/invoice) on return, combine PDT for immediate display and IPN as the reliable backend that completes the order — or adopt PayPal Webhooks for REST integrations if building a new integration. Test everything in Sandbox, monitor the IPN History, and make the listener idempotent; PayPal documents both IPN retry behavior and webhooks best practices. [PDT vs IPN] (https://developer.paypal.com/api/nvp-soap/ipn/IPNPDTAnAlternativetoIPN/) Webhooks overview. (developer.paypal.com)

Notes: ’s idea of writing data to your DB at checkout is useful (mark records pending), but rely on IPN (or webhooks) to transition to completed and to drive emails/fulfillment so orders aren’t lost when buyers never return.

Member Avatar for Member #949455

So, my question is, can someone tell me if I use the PayPal IPN system will it send a message to my web server 'listening' page even if the customer doesn't return to the site?

I don't quite understand your question. Once the customer submit the checkout form it will go to the PayPal page and it will also send the data to your database.

I hope that make sense

Read more about how it works:

https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-info-outside

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.