Paypal sandbox does not complete payment

Phoca Cart - complex e-commerce extension
p38
Phoca Member
Phoca Member
Posts: 33
Joined: 02 Aug 2014, 23:39

Re: Paypal sandbox does not complete payment

Post by p38 »

Hi Jan,

Initially paypal did not work, until I saw in forum to disable SSL, and then it worked fine, all the way to successful payment.

The last entry in the logs says "Order status change", but looking at the change value, it is setting the status to cancelled (value=3), and not completed (value=6).

Code: Select all

2021-03-28 17:49:31 	Notice 	Payment - PayPal Standard - Order Status Change 		173.0.82.126 	https://xxxxxx.xxx/index.php?option=com_phocacart&view=response&task=response.paymentnotify&type=paypal_standard&pid=1&tmpl=component 	Order status changed to: 3, User: Anonymous
Once payment is complete, Phoca indicates as such, so the callback seems to be received correctly, it is just that PhocaCart is setting the incorrect status for some reason.

Image

This is a brand new install, and I mostly did not change any default settings, so it should work virtually out the box.

I have tried everything, to no avail.

I am at a loss now as dont know where to look next.

Paul
p38
Phoca Member
Phoca Member
Posts: 33
Joined: 02 Aug 2014, 23:39

Re: Paypal sandbox does not complete payment

Post by p38 »

Hi Jan,

Do you perhaps have any feedback for me as to where further to look?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Paypal sandbox does not complete payment

Post by Jan »

Hi, the orders status is changed by paypal order status. So first you need to detect which status you got from PayPal and then see the PayPal options to check if this status is assigned to some order status in Phoca Cart.

Jan
If you find Phoca extensions useful, please support the project
p38
Phoca Member
Phoca Member
Posts: 33
Joined: 02 Aug 2014, 23:39

Re: Paypal sandbox does not complete payment

Post by p38 »

Thanks Jan,

How would I detect what the order status is coming back from Paypal if I am using the PhocaPaypal plugin?

The system logs seem to indicate PayaPal was successfull, but yet Phoca is changing teh status to value 3, Cancelled.

2021-03-27 21:47:3 Notice Payment - PayPal Standard - SENDING FORM TO PAYPAL
2021-03-27 21:52:06 Notice Payment - PayPal Standard - SUCCESS
2021-03-27 21:52:06 Notice Payment - PayPal Standard - Order Status Change


On a live payment the money comes off the account, so paypal must be working correctly.

Paul
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Paypal sandbox does not complete payment

Post by Jan »

Did you recheck if all the statuses set in payment method options are correctly set?

Image
If you find Phoca extensions useful, please support the project
p38
Phoca Member
Phoca Member
Posts: 33
Joined: 02 Aug 2014, 23:39

Re: Paypal sandbox does not complete payment

Post by p38 »

Hi, yes, this was the first thing I checked, and Peter confirmed all looked correct. The only thing is I disabled SSL check as paypal did not work at all, and after searching your forum, this was a suggestion to swicth off. Once done, paypal worked perfectly

Image
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Paypal sandbox does not complete payment

Post by Jan »

Hi, are you abe to test the payment again. If, yes, try to open this file:

plugins\pcp\paypal_standard\paypal_standard.php

and change the line cca 535

FROM:

Code: Select all

PhocacartLog::add(1, 'Payment - PayPal Standard - Order Status Change', (int)$id, 'Order status changed to: '.$statusOption);
TO:

Code: Select all

PhocacartLog::add(1, 'Payment - PayPal Standard - Order Status Change', (int)$id, 'Order status changed to: '.$statusOption . '('.$paymentStatus.')');
This should show us the status returned by PayPal to your site.

Please, edit the code, save the changes and try to do the test payment with enabled logging.

Jan
If you find Phoca extensions useful, please support the project
p38
Phoca Member
Phoca Member
Posts: 33
Joined: 02 Aug 2014, 23:39

Re: Paypal sandbox does not complete payment

Post by p38 »

Hi Jan,

Many thanks, your suggestion to output the paypal status in the logs helped me to solve the problem.

It turns out that altho Paypal sandbox will indicate successful payment it turns out I was not aware that, apart from selecting sandbox mode, I also had to put in the sandbox merchant email as well.

I had incorrectly assumed phoca would handle this, and it is not entirely clear in the documents or tooltip.

Perhaps as a suggestion, you can change the tooltip similar below, which would clear up any misunderstanding regarding sandbox setup.
Image
Many thanks to you for your help and Peter as well.

I will be making a donation.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Paypal sandbox does not complete payment

Post by Jan »

Hi, Ok, thank you for the info, I will add the text to next version.

Jan
If you find Phoca extensions useful, please support the project
Ellinor
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 19 Feb 2023, 18:48

Re: Paypal sandbox does not complete payment

Post by Ellinor »

I had the same problem. Turned on logging and this error apperaed: cURL error: [60] SSL certificate problem: unable to get local issuer certificate, User: Anonymous
I then disabled the SSL verification and tried again using the Guest Checkout. Order status still remained pending.
I then disabled the Guest checkout and registered my sandbox user.
Only then the correct status Completed appeared on my order.
It seems to have something to do with the Guest Checkout?

Or is it my settings for Guest Checkout? Is there some way of force create account on Guest Checkout to make it work?

Thanks in advance,
Post Reply