How to clear session using Paypal standard?

software development

#1

Here’s a question that looks really stupid on the surface. :slight_smile:

I built a shopping cart that integrates with several payment processors, one of them being Paypal Standard. The other processors go to a final page where the session is destroyed after the payment is completed. However, with Paypal Standard the user clicks a button to go to paypal. I don’t really want to destroy the session BEFORE they go to Paypal in case they decide they want to change their order.

So how do I go about destroying the session? Should I use a javascript onclick function to call a PHP file and unset the session? Or can I pass the session id and destroy the session when I get the IPN call back from Paypal?

I’m probably making this harder than it has to be. If anyone can flip on the light bulb for me, I’d appreciate it. :slight_smile:

================================
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#2

Congrats!

[quote]that integrates with several payment processors, one of them being Paypal Standard. The other processors go to a final page where the session is destroyed after the payment is completed.
However, with Paypal Standard the user clicks a button to go to paypal. I don’t really want to destroy the session BEFORE they go to Paypal in case they decide they want to change their order.[/quote]
The simplest solution I can think of is to attach an alert box to the PayPal Standard submit button that warns the user that they will not be able to change their order past such-and-such point. Or just not use PayPal at all at that level - I myself only offer PayPal options at the business account level 'cuz I myself don’t always trust sites that redirect to someone else’s payment site.

I’m puzzled as to why destroy the session at all; I actually went through some pains to actually preserve mine so that I can send an email to the customer to let them know that payment was processed (…or rejected).

It’s difficult to say; there are just too many methods of skinning the proverbial cat, and in lots of ways I think the cart software I built does lotsa things just the opposite of the ways you’re doing them. :slight_smile:
Why bother destroying the session at all? Why not just unset or null-out the appropriate variables?


#3

At the previous page I add all the data to the database. So at that point the session isn’t truly necessary unless the customer goes back to add more items. When Paypal replies via IPN, the customer notification email is sent based on the items in the db, not the session.

You’re right, I probably don’t need to destroy the session. Still, the mechanics of the thing are still pretty much the same. I need to unset the session vars. I was thinking maybe I could do some Ajax-y thing to make this work with the onclick.

Unless someone came up with a better idea. :stuck_out_tongue:

As for Paypal Standard, redirecting to their site probably will lose some customers, but Paypal is well enough known by now that it probably won’t be many. I’m working on implementing Paypal Pro as an option, but my god that’s a bear. (What the hell were they thinking?) The fact is that my clients are usually small businesses and offering them the low-entry option with the capability to upgrade is important to them.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#4

I’ve been meaning to diddle with Ajax but haven’t gotten around to it - sounds awfully slick but I need to finish my reading-up on XML first.
The only other method I can fathom for this is to set up a payment gateway return page. Set Paypal to return to a specific page on your site that does a backend process examines the incoming url; if the first $x characters of $HTTP_REFERRER is “http://www.paypal.com/whatever”, you reset variables and/or destroy session. I’m not sure if this is so very workable with Paypal Basic tho…?


#5

Well, in addition to IPN they also do an automatic return page where you have to do more stuff. But…since I hadn’t implemented that yet, I didn’t really want to dig into adding more features.

I’ve got other clients clamoring for their sites. sigh

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#6

[quote][…]
I’ve got other clients clamoring for their sites. sigh[/quote]
My sentiments are with ya sister, my being in somewhat the same boat. And though we may whine about it a bit, it’s always nice to click open QuickBooksPro and enter/send a few fat invoices now’n’then.

Oh-so looking forward to the day when I can tell $DAYJOB to take a short piss up a long rope. :smiley:


#7

I already did that. Instead of one boss who automatically hands you a paycheck, you’ve got a ton of mini-Hitlers making demands. LOL

There are, of course, benefits. Like working in your pjs. But it’s not so glamorous as society would have you believe.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com