What is the correct way to track PayPal purchases that use the standard payment button?

I see on I can fill out the return and rm parameters, but I read somewhere that it requires the user to click "continue" in their browser after the payment has been completed in order to be redirected back to your site. So if they just close the browser it doesn't register accurately.

Also, for the 'rm' parameter it says that if you specify 2, the buyer's browser is redirected and all payment variables are included via POST. But what are the payment variables??

Also how can I test that it's working correctly without actually paying myself?

Dani AI

Generated

Good catch, — the browser return/rm approach is usable for a friendly “thank you” page but is not reliable as the single source of truth for order fulfilment. If a buyer closes the window or the redirect fails, the site never sees that return. PayPal’s own guidance recommends combining return/PDT for the customer experience with a server-to-server notification for reliable processing. (paypal.com)

When the buyer is redirected back (rm=2) PayPal POSTS a set of transaction fields to the return URL. Typical fields to expect include txn_id, payment_status, mc_gross, mc_currency, item_name/item_number, quantity, payer details (email, id, name, address), custom/invoice, ipn_track_id and verification fields such as verify_sign. The full, canonical list is in PayPal’s IPN/PDT variables reference. (developer.paypal.com)

Best practice: enable Auto Return + PDT so the buyer sees immediate confirmation, and implement an IPN (or modern Webhooks where appropriate) listener to update the database and act as the authoritative source. Always validate notifications server-side (the classic IPN flow posts the exact message back to PayPal with cmd=_notify-validate and waits for VERIFIED), and design the backend to be idempotent (handle duplicates) and to ignore unverified or inconsistent messages. Configure a per-transaction notify_url when needed to override the account-level setting. (developer.paypal.com)

For testing without charging real cards, use the PayPal Sandbox and the IPN Simulator to exercise your listener and record the fields PayPal will send. The simulator can send sample IPNs directly to a public listener URL; full sandbox purchases exercise the whole flow (buyer + seller accounts). Log every incoming payload and PayPal response during tests so failures are easy to diagnose. (developer.paypal.com)

Recommended Answers

All 2 Replies

OK I found this ... I think it's what I need:

Member Avatar for Member #949455

but I read somewhere that it requires the user to click "continue" in their browser after the payment has been completed in order to be redirected back to your site. So if they just close the browser it doesn't register accurately.

Yes, the link you find is correct.

You can edit the paypal page to return to original site. You add Daniweb logo on that paypal page.

Also, for the 'rm' parameter it says that if you specify 2, the buyer's browser is redirected and all payment variables are included via POST.

When customer double checking the info & items on the checkout sheet and then they click submit button to submit the checkout sheet.

Once it is submit the info will go to 2 directions.

The 1st direction it will insert the info in the database.

The 2nd direction it will redirect to the PayPal page for customer to enter payment info (credit card) the paypal form is filled already from the checkout sheet.

But what are the payment variables??

This is the form:

https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_prepopulate_outside

Also how can I test that it's working correctly without actually paying myself?

You can test it out here (#3 - Test your integration):

https://www.paypal.com/cgi-bin/webscr?cmd=_wp-standard-integration-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.