Page 1 of 2

Payment Module Error

Posted: Wed May 11, 2022 8:15 am
by radhavallabh
Hi;
I am using 1.0.8.14.
I am using a Indian payment gateway in form of a payment module. And I am getting a redirected to login page after a successful payment transaction or a failed payment transaction.
It does create the order on the backend server but on customer side always redirects to login page.
My redirect URL is
$GLOBALS['Linker']->build('checkout_process.php');

On cancel URL it redirects to
$GLOBALS['Linker']->build('checkout_payment.php');

I tested by clicking cancel payemnt on a order- I checked response in Chrome developer too it shows a 302 checkout_payment redirect from the gateway and hence returns back to login.php instead with 200.

Can you please help me find the issue as not able to figure out what exactly happens?

What further details are required please let me know so shall I provide.

Thank you so much in advance

Re: Payment Module Error

Posted: Wed May 11, 2022 8:22 am
by burt
If something redirects back to login.php when it should not, then the customer session is not active.
You need to find out why your customer session is lost.

Re: Payment Module Error

Posted: Wed May 11, 2022 8:40 am
by ecartz
You could try turning down the xs-cookie (samesite) permissions from the default Lax to None: https://github.com/CE-PhoenixCart/Phoen ... re.php#L29

Another alternative is to turn the admin > Sessions > Force Cookie Use to False. May also require setting the SID manually if not already defined.

Or

Code: Select all

$GLOBALS['Linker']->build('checkout_process.php')->set_parameter(session_name(), session_id());
Beyond that, I don't have more to say than Burt's suggestion of figuring out why it is dropping the session. Those are my three thoughts on how the session might be getting lost.

Re: Payment Module Error

Posted: Wed May 11, 2022 8:55 am
by Kofod95
I have seen the same problem on OSC 2.3.3, PhoenixCart 1.0.4.0 and PhoenixCart 1.0.7.12.
There it happened on Mobile if someone used an app to pay and were returned in another browser than the one they came to the app from.
I hope this can help you find the problem in case the changes mentioned above does not help.

//Daniel

Re: Payment Module Error

Posted: Wed May 11, 2022 9:49 am
by radhavallabh
ecartz wrote: Wed May 11, 2022 8:40 am You could try turning down the xs-cookie (samesite) permissions from the default Lax to None: https://github.com/CE-PhoenixCart/Phoen ... re.php#L29

Another alternative is to turn the admin > Sessions > Force Cookie Use to False. May also require setting the SID manually if not already defined.

Or

Code: Select all

$GLOBALS['Linker']->build('checkout_process.php')->set_parameter(session_name(), session_id());
Beyond that, I don't have more to say than Burt's suggestion of figuring out why it is dropping the session. Those are my three thoughts on how the session might be getting lost.
Hi dear;
Thank you so much it worked like a charm now all works well with this change to the URL

Code: Select all

$GLOBALS['Linker']->build('checkout_process.php')->set_parameter(session_name(), session_id());
:D Thank you again!!!
Very Warm Regds./
radhavallabh

Re: Payment Module Error

Posted: Wed May 11, 2022 10:19 am
by radhavallabh
ecartz wrote: Wed May 11, 2022 8:40 am You could try turning down the xs-cookie (samesite) permissions from the default Lax to None: https://github.com/CE-PhoenixCart/Phoen ... re.php#L29

Another alternative is to turn the admin > Sessions > Force Cookie Use to False. May also require setting the SID manually if not already defined.

Or

Code: Select all

$GLOBALS['Linker']->build('checkout_process.php')->set_parameter(session_name(), session_id());
Beyond that, I don't have more to say than Burt's suggestion of figuring out why it is dropping the session. Those are my three thoughts on how the session might be getting lost.
Fixed the issue I just quoted previously so removed it from here sorry for the trouble.....

Dear @ecartz please help with below

When I try delete a order from admin below error is thrown-

Fatal error: Uncaught Error: Call to undefined method order::remove() in /xx/admin/includes/actions/orders/delete_confirm.php:15 Stack trace: #0 /xx/admin/includes/segments/process_action.php(19): require() #1 /xx/admin/orders.php(16): require('/hermes/walnacw...') #2 {main} thrown in /xx/admin/includes/actions/orders/delete_confirm.php on line 15


Please help me dear,
Thank you in advance;
Regds,/
radhavallabh

Re: Payment Module Error

Posted: Wed May 11, 2022 1:20 pm
by ecartz
Do you have an order.php file in one of admin/includes/classes/, admin/includes/classes/override/, or includes/system/override/ ? If so, either delete it or add the remove function to it from https://github.com/CE-PhoenixCart/Phoen ... p#L46..L63

Re: Payment Module Error

Posted: Wed May 11, 2022 1:34 pm
by radhavallabh
ecartz wrote: Wed May 11, 2022 1:20 pm Do you have an order.php file in one of admin/includes/classes/, admin/includes/classes/override/, or includes/system/override/ ? If so, either delete it or add the remove function to it from https://github.com/CE-PhoenixCart/Phoen ... p#L46..L63
Wow it worked perfectly dear!!!!
Thank you so much.... :D

@ecartz Please help me fix the checkout_payment_address.php error too dear as need to take my site live in full on production level this Friday, need to fix all bugs that I possibly find...
Re writing the issue here for your reference

When a customer tries to change the address on payment page below address is thrown-

Notice: Undefined index: company in xx/includes/modules/customer_data/cd_company.php on line 102

Fatal error: Uncaught TypeError: Argument 1 passed to Text::input() must be of the type string, null given, called in /xx/includes/modules/customer_data/cd_company.php on line 102 and defined in /xx/includes/system/versioned/1.0.8.2/text.php:34 Stack trace: #0 /xx/includes/modules/customer_data/cd_company.php(102): Text::input(NULL) #1 /xx/includes/system/versioned/1.0.5.6/requirements_manager.php(37): cd_company->process(Array) #2 /xx/includes/system/versioned/1.0.5.6/requirements_manager.php(65): requirements_manager->act_on(Object(cd_company), 'process', Array) #3 /xx/checkout_payment_address.php(29): requirements_manager->process(Array) #4 {main} thrown in /xx/includes/system/versioned/1.0.8.2/text.php on line 34

When I applied the fix you gave previously it starts to show the error for country_id which is next on the list....

Please help me fix the issue...

Thanking you in advance;
Regds./
radhavallabh

Re: Payment Module Error

Posted: Wed Jul 06, 2022 6:30 am
by raiwa
Kofod95 wrote: Wed May 11, 2022 8:55 am I have seen the same problem on OSC 2.3.3, PhoenixCart 1.0.4.0 and PhoenixCart 1.0.7.12.
There it happened on Mobile if someone used an app to pay and were returned in another browser than the one they came to the app from.
I hope this can help you find the problem in case the changes mentioned above does not help.

//Daniel
Did you find a solution for this specific case?

Re: Payment Module Error

Posted: Wed Jul 06, 2022 9:47 am
by Kofod95
I hooked a check in on checkout_process, that caught the order_id from the URL and recreated the customers' session from that before the file checks for log-in.

//Daniel