Validating user purchase via IPN?

motionman95
Contributor
Contributor

Here is my setup:

 

  1. A user logs into their account on my site
  2. The user clicks the "Buy Now"
  3. The user completes the purchase, IPN is sent
  4. My server validates the IPN successfully.

This works perfectly except I have no way of marking my user's account as payed. My IPN script is without access to the user's session cookie, which is making it difficult to mark the user's account as payed. Is there anyway I can mark my users account as payed via the IPN message?

 

Thanks in advance...

Login to Me Too
3 REPLIES 3

motionman95
Contributor
Contributor

Wow, I really thought the service on a Paypal Forum would be much better than this.

Login to Me Too

manastojones
Contributor
Contributor

Set a custom field in the buy now button form that would be associated with the user so you can check it against the database.

 

If the user id is 34, do this:

 

 

<form input="hidden" name="custom" value="34" />

 

 

Login to Me Too

kittycattery
Contributor
Contributor

The solution below is correct for passing the user id information. Or you could pass any variable, like the session id in your case. As long as you are storing the SID for this customer on your site, you can add a snippet to your IPN return page that checks for payment_success statement. If it exists, you can update the users data to show that they have paid.

 

What programming language are you using?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.