[Skip to main content](#vessel-content)

#   Payment success on return from gateway

##

- **[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")**
- [![pixxelfactory's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile") Topic Author
- [ Offline](/forum/user/7551-pixxelfactory)

Less More

- Posts: 10
- Thank you received: 0
-
-

6 years 1 month ago [\#324092](#324092) by [pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")  *[Payment success on return from gateway](/forum/31-development/900828-payment-success-on-return-from-gateway#324092 "-- HikaShop version -- : HikaShop Business 4.2.1 -- Joomla version -- : 3.9.21 -- PHP version -- : 7.2  I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins . The code works well, but i have one issue / question: The gateway sends the payment result via get-parameter (success=OK or success=KO). As return url i've added the following url:   xxx.xxx/index.php?option=com&#95;hikashop&amp;am...n=xxx&amp;Itemid=xxx  How do i set the payment success inside the hikashop plugin when the user returns to the site? Since it always shows &quot;Thank you, the order is complete&quot; or similar. How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?  Thanks in advance!")* was created by *[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")*

-- HikaShop version -- : HikaShop Business 4.2.1
-- Joomla version -- : 3.9.21
-- PHP version -- : 7.2

I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins .
The code works well, but i have one issue / question:
The gateway sends the payment result via get-parameter (success=OK or success=KO).
As return url i've added the following url:
[ xxx.xxx/index.php?option=com\_hikashop&amp;am...n=xxx&amp;Itemid=xxx](https://xxx.xxx/index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=after_end&amp;order_id=xxx&amp;order_token=xxx&amp;Itemid=xxx)

How do i set the payment success inside the hikashop plugin when the user returns to the site?
Since it always shows "Thank you, the order is complete" or similar.
How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?

Thanks in advance!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50LzkwMDgyOC1wYXltZW50LXN1Y2Nlc3Mtb24tcmV0dXJuLWZyb20tZ2F0ZXdheT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

6 years 1 month ago [\#324093](#324093) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Payment success on return from gateway](/forum/31-development/900828-payment-success-on-return-from-gateway#324093 "-- HikaShop version -- : HikaShop Business 4.2.1 -- Joomla version -- : 3.9.21 -- PHP version -- : 7.2  I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins . The code works well, but i have one issue / question: The gateway sends the payment result via get-parameter (success=OK or success=KO). As return url i've added the following url:   xxx.xxx/index.php?option=com&#95;hikashop&amp;am...n=xxx&amp;Itemid=xxx  How do i set the payment success inside the hikashop plugin when the user returns to the site? Since it always shows &quot;Thank you, the order is complete&quot; or similar. How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?  Thanks in advance!")*

Hi,

You should provide the "payment notification URL" to the gateway for the return URL. That way, you'll be able to do the confirmation of the order in the onPaymentNotification function of your plugin, and based on the success value, you'll be able to then do a redirect to either the return URL, or the cancel URL.
If you didn't see it yet, I would recommend to check on the example payment plugin available on the documentation. It is heavily commented to better understand what does what.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50LzkwMDgyOC1wYXltZW50LXN1Y2Nlc3Mtb24tcmV0dXJuLWZyb20tZ2F0ZXdheT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")**
- [![pixxelfactory's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile") Topic Author
- [ Offline](/forum/user/7551-pixxelfactory)

Less More

- Posts: 10
- Thank you received: 0
-
-

6 years 1 month ago [\#324154](#324154) by [pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")  Replied by *[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")* on topic *[Payment success on return from gateway](/forum/31-development/900828-payment-success-on-return-from-gateway#324154 "-- HikaShop version -- : HikaShop Business 4.2.1 -- Joomla version -- : 3.9.21 -- PHP version -- : 7.2  I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins . The code works well, but i have one issue / question: The gateway sends the payment result via get-parameter (success=OK or success=KO). As return url i've added the following url:   xxx.xxx/index.php?option=com&#95;hikashop&amp;am...n=xxx&amp;Itemid=xxx  How do i set the payment success inside the hikashop plugin when the user returns to the site? Since it always shows &quot;Thank you, the order is complete&quot; or similar. How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?  Thanks in advance!")*

Thanks, i managed to save the order depending on the gateway-result and also sent the confirmation mail to the shop admin.
However, how do i redirect the user from the "onPaymentNotification" action to the success or failure page? In the example this method simply returns false or true, wich in my case doesn't redirect anywhere.
So i tried to use a manual redirect like this (the url taken from the moneybookers gateway):
header('Location: '.HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=order&amp;task=after_end&amp;order_id='.$dbOrder-&gt;order_id);

It does redirect the user to the url and also the order-id is passed correctly, but i get a 403 access denied...
Where do i need to redirect the user?

Thanks in advance!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50LzkwMDgyOC1wYXltZW50LXN1Y2Nlc3Mtb24tcmV0dXJuLWZyb20tZ2F0ZXdheT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

6 years 1 month ago [\#324159](#324159) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Payment success on return from gateway](/forum/31-development/900828-payment-success-on-return-from-gateway#324159 "-- HikaShop version -- : HikaShop Business 4.2.1 -- Joomla version -- : 3.9.21 -- PHP version -- : 7.2  I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins . The code works well, but i have one issue / question: The gateway sends the payment result via get-parameter (success=OK or success=KO). As return url i've added the following url:   xxx.xxx/index.php?option=com&#95;hikashop&amp;am...n=xxx&amp;Itemid=xxx  How do i set the payment success inside the hikashop plugin when the user returns to the site? Since it always shows &quot;Thank you, the order is complete&quot; or similar. How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?  Thanks in advance!")*

Hi,

Again, please check the code of the example payment plugin.
You'll see there such line:
//$this-&gt;app-&gt;redirect($return_url);
The line is commented so that no redirect happens as it is not needed when it's the payment gateway server directly sending a payment notification request.
But when the payment gateway gateway redirects the customer to the notification URL, you want to use that redirect to move the user to the thank you page.

Your line of code doesn't work properly because you don't set the Itemid parameter in the URL. On some websites, this can lead to Joomla choosing a menu item not accessible and thus you get an error.
as you can see in the example plugin code, the URL has a $this-&gt;url_itemid parameter added to it which is there precisely to avoid that:
$return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=after_end&amp;order_id='.$order_id.$this-&gt;url_itemid;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50LzkwMDgyOC1wYXltZW50LXN1Y2Nlc3Mtb24tcmV0dXJuLWZyb20tZ2F0ZXdheT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")**
- [![pixxelfactory's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile") Topic Author
- [ Offline](/forum/user/7551-pixxelfactory)

Less More

- Posts: 10
- Thank you received: 0
-
-

6 years 1 month ago [\#324185](#324185) by [pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")  Replied by *[pixxelfactory](/forum/user/7551-pixxelfactory "View pixxelfactory's Profile")* on topic *[Payment success on return from gateway](/forum/31-development/900828-payment-success-on-return-from-gateway#324185 "-- HikaShop version -- : HikaShop Business 4.2.1 -- Joomla version -- : 3.9.21 -- PHP version -- : 7.2  I'm developing a payment plugin for a gatewayfor wich no plugin for hikashop exists following the documentation and looking at other plugins . The code works well, but i have one issue / question: The gateway sends the payment result via get-parameter (success=OK or success=KO). As return url i've added the following url:   xxx.xxx/index.php?option=com&#95;hikashop&amp;am...n=xxx&amp;Itemid=xxx  How do i set the payment success inside the hikashop plugin when the user returns to the site? Since it always shows &quot;Thank you, the order is complete&quot; or similar. How do i read the parameter and set the order / payment as failed? Is there a callback and an api how to set the payment-success / failure?  Thanks in advance!")*

Thanks, i managed to make it work that way.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50LzkwMDgyOC1wYXltZW50LXN1Y2Nlc3Mtb24tcmV0dXJuLWZyb20tZ2F0ZXdheT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.087 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
