Web Hosting Talk







View Full Version : PayPal IPN problem


WorldCom
01-29-2008, 11:25 AM
Hi all,

Small problem with a payment script for Paypal.
I'm trying to write it bypassing the settings inside your Palpal account for the IPN destination.

<input type="hidden" name="notify_url" value="http://mysite.com/pay_success.php">This does seem to work as it adds a row to the database, but the variables are not being passed through.

$total_cost = $_POST['amount'];That should retrieve the POST amount from Paypal but it seems not to get through. I even set the return page to force POST instead of GET, even though this isn't the return page ..... only the processing page.

<input type="hidden" name="rm" value="2">Anyone have any snipplets of something they have written that worked??
Thanks for any help.

Czaries
01-29-2008, 12:10 PM
Make a TEXT column in your table structure and store all the $_POST data in there to see what fields are being sent (iterate over them in a foreach loop or something similar). You can further debug from there.

WorldCom
01-29-2008, 12:21 PM
Thanks for the advice, I will try something like that when I have some time later :)

I did find a quick fix ..... but it's not really what I wanted.
I found a section in the docs that said there is only 3 passthrough variables. Does that make sense to anyone??
custom
invoice
item_number

So I just set the amount to invoice and another field to custom and that worked fine........ but it still doesn't make sense to only send 3 fields back and not even the 'amount' field. Why then have the on1 and on2 optional fields.

I'll wait for the experts ;)

WorldCom
01-29-2008, 05:05 PM
Found the solution.
'payment_gross' is the field returned.

That temp fix I used wouldn't work for long ...... using 'invoice' for an amount will cause an error. Apparently Paypal will not accept a duplicate payment ... eg same invoice number.
Makes sense though.