I've set up most parts of the IPN successfully now - it passes through all the information from the transaction successfully. However, I'm having trouble with one aspect still.
I've created a paypal button stored on the paypal server. In 'step 3' in the 'Add advanced variables', I've typed 'custom='. I was hoping this would then enable php and actually print 'custom=the_users_name'. Unfortunately, instead i get literally '' coming back to me instead.
What is the best way to resolve this? I need the IPN to pass back my users name so that I can automatically update my databases to show they've paid.
Many thanks!
The advanced variables section is there for you to add stuff like that, but it doesn't work dynamically. You have to actually include the value you want to pass in that field when you set it up, so it really doesn't do much good.
It used to be that you had to include the custom parameter there and that was the only way it would even get returned (with a hosted button) but it seems like not long ago I accidentally discovered that doesn't seem to be the case anymore.
Try clearing out that advanced variables section in your hosted button details and then go a head and add a field for it in your hosted button code. I'm pretty sure that it should still pass through to IPN now, which was something I was pleased to see (although, I never saw it documented anywhere.)
Give that a shot and it may work for you. If not, you'll need to ditch the hosted buttons and go with a non-hosted one or switch to something like the Express Checkout API, which I would recommend anyway.