Reputation: 1230
I have my code as follows:
$paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
$paypal_id = '[email protected]';
$str .= "<form method='post' action='".$paypal_url."'>";
$str .= "<input type='hidden' name='business' value='".$paypal_id."'>";
$str .= "<input type='hidden' name='cmd' value='_xclick'>";
$str .= "<input type='hidden' name='item_name' value='Room'>";
$str .= "<input type='hidden' name='item_number' value='".getRoom($id)."'>";
$str .= "<input type='hidden' name='currency_code' value='USD'>";
$str .= "<input type='hidden' name='no_shipping' value='1'>";
$str .= "<input type='hidden' name='amount' id='paypal_cost' value='".getBal($id)."'>";
$str .= "<input name='notify_url' value='http://localhost/tropicana/guests/notify.php' type='hidden'>";
$str .= "<input type='hidden' name='cancel_return' value='http://localhost/tropicana/guests/payments.php'>";
$str .= "<input type='hidden' name='return' value='http://localhost/tropicana/guests/notify.php'>";
$str .= "<button type='submit' name='submit' class='form-control btn-danger'>Pay $".getBal($id)." with <i>PayPal</i>";
$str .= "</form>";
But after a successful payment, my return script notify.php
is not receiving any variables.
When i try to print_r()
the $_REQUEST
, it returns an empty array.
Upvotes: 1
Views: 566
Reputation: 1903
TL;DR: Your notify_url
cannot be localhost since PayPal will send you the IPN messages (from outside), which means your development machine must be exposed to internet.
One way to expose your computer is using a tool like ngrok, or something like serveo, or similar. Once you do that, set your notify_url to that public URL to receive the IPN messages.
But, be warned:
Of course, you will scratch your head sometimes why things worked yesterday and not today. The best option is to boycott them and move on with your life and business with someone who's actually competent on this field.
Upvotes: 1