Link to home
Start Free TrialLog in
Avatar of sky479
sky479

asked on

Paypal, mysql, and php

Hi,

I am new here, and I joined to get some help. What I have so far is a reward shop. What I need is  a donation system where users who donate money to help support the server receives virtual points.

My problem is I am unable to get the donation system to set up! I need to be able to log the username of the person donating and the amount. Then from there update my sql database and award the donor with donor points. But so far I have no luck with the php coding or the paypal IPN. If someone can help me get this project going it would be great!

Edit: I can donate and it updates to my database. but the thing is I don't know how to make it so it updates the right account . My donate table is different from my account table. And all it stores into the paypal table is the transaction id, amount, email, etc. How would I go about programming a code in php where it checks the session to see if the person is logged in, if so then it sends that data(username, id, email) to database. When paypal sends the info back it verifys and updates the points to the right account. Where would I go about doing something like this?
Avatar of Bardobrave
Bardobrave
Flag of Spain image

Let's see... If I'm understanding you right the problem is that your donation page, after returning from paypal service, loses session user parameters and you don't know how to associate the donation to a user account.

Usually payment platforms are base upon webservices that expect some parameters related to transaction and return different values depending on the result of the transaction.

I supose you probably are sending the execution directly to paypal, and when their service returns your page has lost session data.

What you need to do is:

1) Ask for your users to log onto your system.
2) Send to paypal service the transaction data without losing your current session environment (use an AJAX call, include paypal form inside your page code if user interaction is required for transaction or simply open it in a new window).
3) On paypal service return, from your code, check the value of the response and save data to your database accordingly.
SOLUTION
Avatar of Scott Madeira
Scott Madeira
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sky479
sky479

ASKER

Thanks a lot I will try both of your methods and see how it goes. I've been trying for days so I thought I should seek professional help. I got a work frame to work with now, before I was in the dark searching everywhere on what to do. Thanks again and I am going to try your 2 methods and see what I come up with. Will update you guys on how I did it and see if it works.
Avatar of sky479

ASKER

Btw...do I need the  ipn-listener.php? I have the ipn.php but I don't know if they are similar or not.
Avatar of sky479

ASKER

Okay, if I where to hire someone to help me with this where would I get the help and how much do you guys think it will cost me?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure if this question is still active, but I have done exactly the thing you are talking about for my church.  We accept donations via PayPal.  In practical terms, we receive about as much money via PayPal as we receive via cash in the collection plate.

We have a separate bank account associated with PayPal donations.  The PayPal IPN script is used to keep a log of donations (although PayPal keeps this information for us, too).  Information available in the IPN script includes the donor's email address, and given the anonymity of church donations, this is all we use to keep track of the donors and the amounts.  Our log of donations enables us to give the donors quarterly and annual statements.

You cannot check a client session in the IPN script.  It is an asynchronous script that is not associated with a client session.  So your design that associates points with donations must use something other than the session.  That is why we use the email address from PayPal as the client identifier.

HTH, ~Ray
Avatar of Guy Hengel [angelIII / a3]
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.