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

#   How to capture authorized transaction

##

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

Less More

- Posts: 21
- Thank you received: 0
-
-

6 years 4 months ago [\#321866](#321866) by [ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")  *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321866 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")* was created by *[ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")*

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.3

Hello,

I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.

I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment.
So please let me know how to achieve Capture feature for authorized transaction.

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy85MDAzODAtaG93LXRvLWNhcHR1cmUtYXV0aG9yaXplZC10cmFuc2FjdGlvbj90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

6 years 4 months ago [\#321895](#321895) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321895 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Hi,

There is nothing specific for that. It's up to the payment plugin to implement it how ever it wants.
Normally, I would guess that you would add a function onAfterOrderUpdate(&amp;$order) and check the status of the order in $order-&gt;order_status and in $order-&gt;old-&gt;order_status so that you see that the order status is being changed from one status to another so that you would launch the cURL request to the payment gateway to capture the payment.
In most cases, merchants want to capture the payments directly when the payment is made by the customer so all the plugins I saw so far work like that and don't have an extra step to manually do the capture.

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

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

Less More

- Posts: 21
- Thank you received: 0
-
-

6 years 4 months ago [\#321896](#321896) by [ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")  Replied by *[ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321896 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Okay, I’ll try your suggestion.

Also I want to add a custom button on order detail page through my payment plugin and when this button is hit, I want to execute some code written in my plugin.

So please let me know the way to add custom button.

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy85MDAzODAtaG93LXRvLWNhcHR1cmUtYXV0aG9yaXplZC10cmFuc2FjdGlvbj90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

6 years 4 months ago [\#321898](#321898) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321898 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Hi,

You want to implement the onHikashopBeforeDisplayView(&amp;$view) function in your plugin.
In it, you need to check the task and layout of the view ( $view-&gt;getLayout() and $view-&gt;ctrl ) so that you only add the button for the view you're targeting.
Then, you want to push an array with the correct parameters in the variable $this-&gt;toolbar.
For example: Code:

if($viewName == 'order' &amp;&amp; $layout == 'show' &amp;&amp; !empty($view-&gt;order-&gt;order_id)) { $url = hikashop_completeLink('xxx&amp;task=yyy&amp;order_id='.$view-&gt;order-&gt;order_id); $button = array('name' =&gt; 'popup','icon'=&gt;'upload','alt'=&gt;JText::_('zzz'),'url'=&gt;$url); array_unshift($view-&gt;toolbar, $button); }

And you can also implement such function in your plugin to register your controller: Code:

public function onHikashopPluginController($ctrl) { if(hikashop_isClient('administrator')) { return array( 'type' =&gt; 'hikashop', 'name' =&gt; 'xxx', 'prefix' =&gt; 'ctrl' ); } }

and then you can have the file xxx.php in your plugin to act as a controller.
You can find an example of that in plugins/hikashop/email_history/
Please note that all these are for a plugin of the group "hikashop". If your plugin is of the group "hikashoppayment", it mgith not be triggered by some of these. So in that case, two plugins might be needed, or a system plugin.

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

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

Less More

- Posts: 21
- Thank you received: 0
-
-

6 years 4 months ago [\#321918](#321918) by [ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")  Replied by *[ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321918 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Hello,

I tried below code to add custom button but when clicking on button nothing is happening. It is just giving error "Page not found : invoice".

Here is the my code :
Code:

class plgHikashopMygateway_invoice extends JPlugin { public function __construct(&amp;$subject, $config) { parent::__construct($subject, $config); } public function onHikashopBeforeDisplayView(&amp;$view) { if($view-&gt;request['ctrl'] == 'order' &amp;&amp; $view-&gt;request['task'] == 'show') { $url = hikashop_completeLink('invoice&amp;task=generate&amp;order_id=134'); $button = array('name' =&gt; 'popup','icon'=&gt;'upload','alt'=&gt;JText::_('Generate Invoice'),'url'=&gt;$url); array_unshift($view-&gt;toolbar, $button); } } public function onHikashopPluginController($ctrl) { if(hikashop_isClient('administrator')) { return array( 'type' =&gt; 'hikashop', 'name' =&gt; 'invoice', 'prefix' =&gt; 'ctrl' ); } } }

And here the controller file invoice.php, I tried to name it invoice_ctrl.php an invoice.php but none of worked :
Code:

class invoiceController extends hikashopController { public $modify = array(); public $delete = array(); public $modify_views = array(); public function __construct($config = array(), $skip = false) { parent::__construct($config, $skip); $this-&gt;display = array_merge($this-&gt;display, array( 'generate' )); } public function generate() { $this-&gt;writeToLog("Test"); } function writeToLog($data = null) { if(!empty($data)) { hikashop_writeToLog($data, $this-&gt;name); if(is_array($data) &#124;&#124; is_object($data)) $data = str_replace(array("\r","\n","\r\n"),"\r\n",print_r($data, true))."\r\n\r\n"; $this-&gt;cachedDebug .= $data; } return $this-&gt;cachedDebug; } }

And here is the xml file :
Code:

&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;extension type="plugin" version="2.5" method="upgrade" group="hikashop"&gt; &lt;name&gt;Hikashop Mygateway Invoice Plugin&lt;/name&gt; &lt;creationDate&gt;17 juin 2020&lt;/creationDate&gt; &lt;version&gt;4.3.0&lt;/version&gt; &lt;author&gt;Hikashop&lt;/author&gt; &lt;authorEmail&gt;dev@hikashop.com&lt;/authorEmail&gt; &lt;authorUrl&gt;http://www.hikashop.com&lt;/authorUrl&gt; &lt;copyright&gt;(C) 2010-2020 HIKARI SOFTWARE. All rights reserved.&lt;/copyright&gt; &lt;license&gt;http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL&lt;/license&gt; &lt;description&gt;This plugin enables you to download invoice&lt;/description&gt; &lt;files&gt; &lt;filename plugin="mygateway_invoice"&gt;mygateway_invoice.php&lt;/filename&gt; &lt;filename&gt;invoice.php&lt;/filename&gt; &lt;/files&gt; &lt;/extension&gt;

Please let me know if I am doing something wrong.
Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy85MDAzODAtaG93LXRvLWNhcHR1cmUtYXV0aG9yaXplZC10cmFuc2FjdGlvbj90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

6 years 4 months ago [\#321934](#321934) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321934 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Hi,

Since your plugin name is mygateway_invoice I think that xxx should be replaced by mygateway_invoice
and thus the file invoice.php should be mygateway_invoice_ctrl.php etc

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

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

Less More

- Posts: 21
- Thank you received: 0
-
-

6 years 4 months ago [\#321948](#321948) by [ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")  Replied by *[ajdev33](/forum/user/59738-ajdev33 "View ajdev33's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321948 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

I tried the same way you told but still getting mygateway_invoice file not found. I don't know why this is not working for me.

if you have sample code then please let me know.
Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy85MDAzODAtaG93LXRvLWNhcHR1cmUtYXV0aG9yaXplZC10cmFuc2FjdGlvbj90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

6 years 4 months ago [\#321957](#321957) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to capture authorized transaction](/forum/29-payment-methods/900380-how-to-capture-authorized-transaction#321957 "-- HikaShop version -- : 4.3.0 -- Joomla version -- : 3.9.19 -- PHP version -- : 7.3  Hello,  I am implementing a third party payment gateway which has authorize and sale feature. So when I use Sale while making payment then it works fine but when I use authorize, payment functionality works fine but after that I don't see any option in order details page to Capture this transaction.  I also checked Authorize payment gateway but I did not find any code or button to capture authorized payment. So please let me know how to achieve Capture feature for authorized transaction.  Thanks")*

Hi,

Well, as I said in a previous message, in the folder plugins/hikashop/email_history you have a full example. That plugin adds the menu Customers&gt;Emails history in your backend and has a controller to for the different tasks.
Also, when looking at this plugin, I just remebered that you also need to have a views folder with a xxx folder inside and inside it a file view.html.php (that's the file which will handle the display if your controller needs any). I suspect it might be why it's not working.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy85MDAzODAtaG93LXRvLWNhcHR1cmUtYXV0aG9yaXplZC10cmFuc2FjdGlvbj90bXBsPW1hcmtkb3du) 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.098 seconds

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