Trouble getting a custom variable back from PayPal after payment received
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a custom website, using PHP for selling coffee mugs. I have no trouble sending the cart total to PayPal, having the customer pay, and then having PayPal redirect back to my site for a thank you message. But the PHP session objects are destroyed upon return. So I am placing the cusomer info into my database prior to them clicking the PayPal payment button, along with a unique key so I can retrieve it later. I send the unique key (called "pp") to PayPal as a pass-through, but it is not coming back to me via post. Here is the code for my payment button:
echo "<input type=\"hidden\" name=\"cmd\" value=\"_ext-enter\">
<form action=\"https://www.paypal.com/us/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"xxxl.com\">
<input type=\"hidden\" name=\"custom\" value=\"".$pp."\">";
echo "<input type=\"hidden\" name=\"amount\" value=\"".$_SESSION['gt']."\">";
echo "<input type=\"hidden\" name=\"no_shipping\" value=\"1\">
<input type=\"hidden\" name=\"item_name\" value=\"Specialty Coffee Mugs\">
<input type=\"hidden\" name=\"cancel_return\" value=\"http://www.xxx.com/xxxt.php\">
<input type=\"hidden\" name=\"return\" value=\"http://www.xxx.com/xxxou.php\">
<input type=\"image\" src=\"http://www.paypal.com/en_US/i/btn/x-click-but01.gif\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">
</form>";
Then, on the thank you page (the page PayPal directs the customer back to), I attempt to retrieve the variable via the following:
$pp=$_POST['custom'];
I don't get anything back.
Can anyone tell me what I'm doing wrong?
Thanks!
- Labels:
-
PayPal HTML Buttons

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Couldn't receive International payment in PayPal Payments Standard
- Assistance Needed: Passing and Retrieving Custom Data in PayPal Webhook Payload in PayPal Payments Standard
- Not receiving any confirmation emails for sandbox account in Sandbox Environment
- use the payment button code with variable price in REST APIs
- Paypal via Adyen Permission Denied in REST APIs