Forum

Thread tagged as: Problem, Shop

Perch Shop Paypal Express Failure/Success

Hi,

So I have an ALMOST working perch shop setup. I say almost, as there is a bug - no matter what, orders are technically successful (payment is made via paypal and the orders are logged in the perch database as 'Paid'), however, often "perch_shop_order_successful()" doesn't return as true (sometimes it does), even when Paypal and Perch have both marked it as paid (and payment is taken successfully).

Are there any known issues that may cause this? I've had a good look around the forum, and altered several things (like calling perch_shop_complete_payment('paypal-express') and perch_shop_order_successful() before headers are sent) but nothing seems to have worked.

Thanks in advance for any help!

Matthew Lymer

Matthew Lymer 1 points

  • 3 years ago

If it could be causing the issue, I have noticed that orders (in Perch) are being stored with an incorrect time (1 hour earlier than they actually happen). I updated the "PERCH_TZ" value in my config file to represent my actual timezone, but I can see that it is still saving orders an hour early - if this is likely to be the issue, do you know how I can change the Timezone perch is using?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you in the UK? If so, you're seeing the orders saved as UTC, not BST. We do that so that there's a consistent timeline regardless of daylight savings.

I am indeed - so that's not something that would mess with Paypal then?

In that case, the last area I'm thinking of is the SESSION (when I looked into perch_shop_order_successful() it look like it checks that the same SESSION is still open). Until recently, my pages did not include the "start_session()" variable (I didn't think it mattered, as it seems to work mostly). I've now added that in, and am testing further.

I'm going to test if "perch_shop_orders()" returns anything when "perch_shop_order_successful()" is false - if not, I suppose I can be sure the issue is probably SESSION/COOKIE related, as it means the user has probably been logged out.

I think as perch_shop_order_successful() is intermittently returning false, even when true, I may have to create a fallback function that checks the database for am existing and paid paypal payment under the the paypal paymentID (probably within a window of time) - that way if perch_shop_order_successful() is false, I can always use that as a fallback.

Hi,

As a follow up to this, I amended the system to use "start_session()" in all instances. This seemed to resolve the problem (as we have had approximately 50 successful orders since). However, the last order today seems to have given a value of FALSE for "perch_shop_order_successful()" (again, in-spite of the paypal payment being successful and the order correctly being marked as "paid" in the database).

Any help you can offer would be used, but I believe I'm going to have create a fallback function that checks the database for existing completed orders (as all I can think is that the session is dying).

Regards,