SQL/PHP Paypal Question

Scarpozzi

Lifer
Jun 13, 2000
26,379
1,766
126
I'm setting up a site that's selling tickets to an event. Someone logs in to the site and they're presented with a pay now button to a Paypal account.

After they pay at Paypal, I want to update my db so I know how many tickets they bought. Paypal lets me direct them to a confirmation page of my choice...I'd like to set this page up so it updates a couple of attributes in the DB.

How would I code this in PHP? Everything I have going to php requires a post or submit action and I'd like it to be transparent to the user.

Thanks.
 

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
144
106
www.neftastic.com
Go look up PayCrap's API... I'm sure they have it on their website. Or better yet, use a real payment service like Google Checkout.
 

Scarpozzi

Lifer
Jun 13, 2000
26,379
1,766
126
Originally posted by: SunnyD
Go look up PayCrap's API... I'm sure they have it on their website. Or better yet, use a real payment service like Google Checkout.
Not my choice...I'm just volunteering my time on the site.

They have a straight-up button generator that basically throws all of their variables in. This makes it easy on the paypal side... The problem is that when the user clicks that button, they go to paypal and I can't confirm whether or not they actually made the payment until they get redirected back to my site. So, the API isn't going to help. I need to know how to update a variable without requiring a user click.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
It's easier if you use their IPN system. You basically set a callback URL and through a series of POST requests you will get notifications of payments/signups or whatever you specify in your paypal link.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
sounds like setting up zencart or oscommerce would be faster and more functional - both php carts have all that functionality built in.
 

Scarpozzi

Lifer
Jun 13, 2000
26,379
1,766
126
I figured it out. There was something wrong with the query for some reason. (I still don't know what). When I tried to execute it the first time it was only setting the local vars. It's working now....a lot simpler than using Paypal's crap. They have way too much data for this project...I was able to do what I needed with 3 variables.
 

drebo

Diamond Member
Feb 24, 2006
7,035
1
81
PayPal's IPN is the method that you need to do this to guarantee accuracy and security.

The "Thank You" page does not tell you that payment was actually processed...meerly that the customer went through the process of paying. IPN tells you that payment was actually processed and that everything is complete. The "Thank You" page is not verification.
 

Furor

Golden Member
Mar 31, 2001
1,895
0
0
Originally posted by: drebo
PayPal's IPN is the method that you need to do this to guarantee accuracy and security.

The "Thank You" page does not tell you that payment was actually processed...meerly that the customer went through the process of paying. IPN tells you that payment was actually processed and that everything is complete. The "Thank You" page is not verification.

Unfortunately, PayPal IPN is far from reliable. IPN is regularly down and/or delayed. I would recommend a method of TransactionSearch if you still need to retrieve payment info.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Furor
Originally posted by: drebo
PayPal's IPN is the method that you need to do this to guarantee accuracy and security.

The "Thank You" page does not tell you that payment was actually processed...meerly that the customer went through the process of paying. IPN tells you that payment was actually processed and that everything is complete. The "Thank You" page is not verification.

Unfortunately, PayPal IPN is far from reliable. IPN is regularly down and/or delayed. I would recommend a method of TransactionSearch if you still need to retrieve payment info.

It's far more reliable then hoping the user clicks on a link :)

In general, paypal and their API's suck. Try dealing with subcriptions only to have to a payment notification come through before you get a subscriber signup notification!

In production though, most of the IPN notifications would come through a few seconds after the transaction was completed and with some extra coding it's pretty easy to get around out of order notifications.
 

ASK THE COMMUNITY