Selling with Paypal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Selling with Paypal

Post by tonchily »

Okay so I have these 5 products that users get to choose from select box and click on Pay now button (all code generated via Paypal)
These products are actually (kind of) lottery tickets, and I want to do the following:

when the users choose for example 2 lottery tickets, generate the random two numbers and store it in the db, and after the payment has been made update these two rows and set column "payed" to 1

I really have no idea on how to accomplish this because I don't know how to interact with Paypal (if that's what I have to do)

Thanks for your help
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Selling with Paypal

Post by oscardog »

Well, the initial part should be a piece of cake (generating the numbers and storing them).

NetTuts have a nice tutorial on using PayPal's IPN here.
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Re: Selling with Paypal

Post by tonchily »

oscardog wrote:Well, the initial part should be a piece of cake (generating the numbers and storing them).

NetTuts have a nice tutorial on using PayPal's IPN here.
Yeah, but I don't know how to do it.
I mean, I can create php file that will generate numbers and store them in DB with column payed=0
but how can I later find out which row(s) to update to payed=1 once the payment in completed?
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Selling with Paypal

Post by oscardog »

tonchily wrote:
oscardog wrote:Well, the initial part should be a piece of cake (generating the numbers and storing them).

NetTuts have a nice tutorial on using PayPal's IPN here.
Yeah, but I don't know how to do it.
I mean, I can create php file that will generate numbers and store them in DB with column payed=0
but how can I later find out which row(s) to update to payed=1 once the payment in completed?
Read the tutorial. It explains it all, including the response that PayPal sends when a payment is completed.

Look at 'Step 5 – Writing ipn.php'.
TeeTwo
Forum Newbie
Posts: 10
Joined: Mon Oct 25, 2010 5:58 pm

Re: Selling with Paypal

Post by TeeTwo »

If I remember correctly using PayPals setup you are allowed to set a success page for the client to go to after the transaction. This can be success.php from there you can re open the database and change status. If you use sessions then you can track the client.
There is plenty of help on accessing a database using php Ref http://www.w3schools.com/php/
Seek and you shall find.

Terry
Post Reply