jafferpg Posted November 15, 2022 Share Posted November 15, 2022 Hi, I created a custom payment module and process the payment. Once complete the payment I need to redirect to success page with proper validation . But its redirecting to login page instead of success page. please check code below and appreciate your support and feedback please if (isset($response['Transaction']['ResponseCode']) && isset($response['Transaction']['ApprovalCode']) && ($response['Transaction']['ResponseCode'] == 0)) { $amount = $this->context->cart->getOrderTotal(); $amount = Tools::ps_round($amount, 2); $order = $this->createOrder($amount); $URL = Context::getContext()->link->getPageLink( 'order-confirmation', true, null, [ 'id_cart' => (int) $this->context->cart->id, 'id_module' => (int) $this->module->id, 'id_order' => (int) Order::getIdByCartId($this->context->cart->id), 'key' => $this->context->customer->secure_key, ] ); Tools::redirect($URL); } public function createOrder(float $amount): ?Order { $order = null; if ($this->module->active && 0 != $this->context->cart->id_customer && 0 != $this->context->cart->id_address_delivery && 0 != $this->context->cart->id_address_invoice && Validate::isLoadedObject($this->context->customer) && in_array('EPG', array_column(Module::getPaymentModules(), 'name')) ) { if ($this->context->cart->orderExists()) { $order = new Order(Order::getIdByCartId($this->context->cart->id)); } elseif ($this->module->validateOrder( (int) $this->context->cart->id, 'Payment accepted', $amount, $this->module->displayName, null, [], $this->context->cart->id_currency, false, $this->context->customer->secure_key ) && !empty($this->module->currentOrder) ) { $order = new Order($this->module->currentOrder); } } return $order; } Appreciate your support please Link to comment Share on other sites More sharing options...
Rhobur Posted November 16, 2022 Share Posted November 16, 2022 Try with setting the "Cookie SameSite" to None in Advanced Parameters -> Administration. Link to comment Share on other sites More sharing options...
jafferpg Posted November 17, 2022 Author Share Posted November 17, 2022 Thanks Rhobur for your response When I try to change the setting, I am getting "The SameSite=None is only available in secure mode". prompt. Any alternative way to change Link to comment Share on other sites More sharing options...
Rhobur Posted November 17, 2022 Share Posted November 17, 2022 You don't have SSL working on your site? If you don't, add it. Link to comment Share on other sites More sharing options...
jafferpg Posted November 17, 2022 Author Share Posted November 17, 2022 (edited) I can't able to add SSL because I am developing custom payment module development on my system(localhost). To inform you that, I am trying to redirecting prestashop success page from same custom module(view folder file) only not from any external page/site. Appreciated for your support. Looking for your further support to close the project as am stuck in the final stage Edited November 17, 2022 by jafferpg (see edit history) Link to comment Share on other sites More sharing options...
Rhobur Posted November 17, 2022 Share Posted November 17, 2022 Doesn't matter where from, you have to use SSL and try what I have advised. There are ways to set up SSL on localhost, google for this. Link to comment Share on other sites More sharing options...
pg_dev Posted November 18, 2022 Share Posted November 18, 2022 (edited) @jafferpg@RhoburHi, I'm developing a same payment module as yours in localhost. But I'm new to prestashop 1.7 and I'm stuck at one place. I have made progress till the configuration page. Can you pls let me know how and where, I mean in which file you defined post parameters for request url and how to validate them? Do i have to call those parameters in tpl file or it should be defined in front controller and then whats the process after this? I tried to get some reference from prestashop payment example module but there is nothing about how to handle parameters for request url and it confuses me more. Pls help me pls. 🙏 Anyone's help will be much appreciated. Edited November 18, 2022 by pg_dev (see edit history) Link to comment Share on other sites More sharing options...
Rhobur Posted November 18, 2022 Share Posted November 18, 2022 Please open a new topic for your issue do not use another's. There is a quite explanatory module creation documentation at https://devdocs.prestashop-project.org/ Link to comment Share on other sites More sharing options...
TonyKapa Posted November 21, 2022 Share Posted November 21, 2022 I use Prestashop 1.7.6.4 where there isn't the Cookie SameSite option available to change and I have run into the same problem. Any solution around that? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now