Page 1 of 1

Selling with Paypal

Posted: Sat Apr 30, 2011 6:12 am
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

Re: Selling with Paypal

Posted: Sat Apr 30, 2011 6:49 am
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.

Re: Selling with Paypal

Posted: Sun May 01, 2011 5:01 am
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?

Re: Selling with Paypal

Posted: Mon May 02, 2011 11:03 am
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'.

Re: Selling with Paypal

Posted: Mon May 02, 2011 6:14 pm
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