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

#   No Payment Menthod?

##

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#88539](#88539) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88539 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")* was created by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")*

Hi,

I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.

At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.

When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?

Any help would be greatly appreciated. Thanks in advance.

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

13 years 8 months ago [\#88571](#88571) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88571 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

Can you show me screenshots of how did you configured your payment methods ? and can you uncheck all currencies through the "Currency" option of your payment method ?

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#88608](#88608) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88608 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi Mohamed. Thank you very much for helping. Here's the screenshot in USD.

[ ![650](http://www.wstudiographics.com/wsg-tags/CheckoutUSD.JPG) ](http://www.wstudiographics.com/wsg-tags/CheckoutUSD.JPG "650")

This is what happens when I switch to JMD.

[ ![650](http://www.wstudiographics.com/wsg-tags/CheckoutJMD.JPG) ](http://www.wstudiographics.com/wsg-tags/CheckoutJMD.JPG "650")

Right now, none of the shipping or payment methods have any zone restrictions applied to them.

Any idea what could be causing this?

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

13 years 8 months ago [\#88725](#88725) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88725 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

Like I said earlier, I was talking about your payment method configuration so can you check if you had set any currency limitation through the "Currency" option of your payment method ?.

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#88832](#88832) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88832 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi Mohamed.

Both currencies are selected. I made sure of that. (See below)

[ ![&#91;img](http://www.wstudiographics.com/wsg-tags/PaymentConfig.JPG) ](http://www.wstudiographics.com/wsg-tags/PaymentConfig.JPG "&#91;img")

All published shipping methods are selected also and no Zones selected.

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#88904](#88904) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88904 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Is it possible to use the same payment module more than once? I could set one exclusively for USD and the other exclusively for JMD. I could add a zone restriction to Jamaica only for the one with JMD and leave the other one open for all zones. Is this possible?

What if I duplicate the payment plugin and change all the occurrence of the payment plugin's to something else.. e.g. "authorize" to "authorizejmd".. Could this work?

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#88975](#88975) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#88975 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

Yes you can duplicate the payment plugin, be sure to change all the occurrence of "authorize"

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#89072](#89072) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89072 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

I tried duplicating the plugin and setting it for JMD currency on it's own and still nothing. I tested the dupped plugin by configuring it like I did the first one and it shows up and works fine when the currency is in USD.

Any other idea how? Is this a bug you think?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc4MDQzLW5vLXBheW1lbnQtbWVudGhvZD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

13 years 8 months ago [\#89211](#89211) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89211 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

The authorize.net payment plugin only displays for USD.
That's because authorize.net only allows payment to be made in USD.

I see that you're using an emulator and changed the URL of the payment gateway to use plug'n'pay instead of authorize.net
However, the authorize.net payment gateway doesn't have any parameter to give the currency of the payment since it's always USD, so even if we were to add the display of auhtorize.net plugin for JMD (which is quite easy), I don't see how HikaShop could pass JMD payments to plug'n'pay via the authorize.net emulator since there is no variable to specify the currency in the API.

Maybe plug'n'pay only allows for USD payments if you use the emulator and allows for other currencies if you develop a plugin for their API ?

I would recommend you to contact their support to find out about all that. Maybe it's just one or two lines of code to add to the plugin...

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#89245](#89245) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89245 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

That's a good point Nicolas. Thanks.

I've been trying to figure out how to create a proper plugin for Plug 'n Pay. I'm not much of a coder, but if I get good instruction and explanations, I can pull it together myself. Unfortunately, the development documentations here don't really offer much.

I downloaded the documentations necessary for creating a plugin from Plug 'n Pay website. They also offer a PHP plugin for download from. Their PHP script is a simple implementation with with all the information that may be sent to Plug 'n Pay for a proper transaction. I'm not sure where what goes and HikaShop doesn't have all the information needed to pull it together.

What would be great is a basic starter plugin with comments. Any idea where to go for this?

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago -  13 years 8 months ago [\#89264](#89264) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89264 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

From what I'm reading from Authorize.net, the card type (x_currency_code) is optional. It seems that the Authorize.net plugin doesn't send this info.

Although Authorize.net only expects x_currency_code to carry the values of USD, CAD or GBP, maybe if we force it to only send USD or JMD, the PnP emulator may pick it up. I'm willing to give this a try.

So how do I implement that currency parameter into the authorize plugin? I've done some modification to my Authorize.net plugin already in trying to get rid of the plugin sending PostAuth by forcing it to send Auth_only. This disables the Instant Capture parameter (doesn't seems to be working anyways).

**authorize.php file:**
Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.0.0 * @author hikashop.com * @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php class plgHikashoppaymentAuthorize extends JPlugin { var $debugData = array(); function onPaymentDisplay(&amp;$order,&amp;$methods,&amp;$usable_methods){ if(!empty($methods)){ foreach($methods as $method){ if($method-&gt;payment_type!='authorize' &#124;&#124; !$method-&gt;enabled){ continue; } if(!empty($method-&gt;payment_zone_namekey)){ $zoneClass=hikashop_get('class.zone'); $zones = $zoneClass-&gt;getOrderZones($order); if(!in_array($method-&gt;payment_zone_namekey,$zones)){ return true; } } $currencyClass = hikashop_get('class.currency'); $null=null; $currency_id = intval(@$order-&gt;total-&gt;prices[0]-&gt;price_currency_id); $currency = $currencyClass-&gt;getCurrencies($currency_id,$null); if(!empty($currency) &amp;&amp; @$currency[$currency_id]-&gt;currency_code != 'USD'){ return true; } $this-&gt;needCC($method); $usable_methods[$method-&gt;ordering]=$method; } } return true; } function needCC(&amp;$method) { if(@$method-&gt;payment_params-&gt;api=='aim'){ $method-&gt;ask_cc=true; if($method-&gt;payment_params-&gt;ask_ccv){ $method-&gt;ask_ccv = true; } return true; } return false; } function onPaymentSave(&amp;$cart,&amp;$rates,&amp;$payment_id){ $usable = array(); $this-&gt;onPaymentDisplay($cart,$rates,$usable); $payment_id = (int) $payment_id; foreach($usable as $usable_method){ if($usable_method-&gt;payment_id==$payment_id){ return $usable_method; } } return false; } function onBeforeOrderCreate(&amp;$order,&amp;$do){ $app =&amp; JFactory::getApplication(); if($app-&gt;isAdmin()){ return true; } if(empty($order-&gt;order_payment_method) &#124;&#124; $order-&gt;order_payment_method != 'authorize'){ return true; } $db = JFactory::getDBO(); $query = 'SELECT * FROM '.hikashop_table('payment').' WHERE payment_type='.$db-&gt;Quote($order-&gt;order_payment_method); $db-&gt;setQuery($query); $paymentData = $db-&gt;loadObjectList('payment_id'); $pluginsClass = hikashop_get('class.plugins'); $pluginsClass-&gt;params($paymentData,'payment'); $method =&amp; $paymentData[$order-&gt;order_payment_id]; if(@$method-&gt;payment_params-&gt;api!='aim'){ return true; } if(!function_exists('curl_init')){ $app-&gt;enqueueMessage('The Authorize.net payment plugin in AIM mode needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.','error'); return false; } $vars = $this-&gt;_loadStandardVars($order,$method); $vars["x_delim_data"]= "TRUE"; $vars["x_delim_char"] = "&#124;"; $this-&gt;cc_number = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.cc_number'); if(!empty($this-&gt;cc_number)){ $this-&gt;cc_number = base64_decode($this-&gt;cc_number); } $this-&gt;cc_month = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.cc_month'); if(!empty($this-&gt;cc_month)){ $this-&gt;cc_month = base64_decode($this-&gt;cc_month); } $this-&gt;cc_year = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.cc_year'); if(!empty($this-&gt;cc_year)){ $this-&gt;cc_year = base64_decode($this-&gt;cc_year); } $vars["x_card_num"] = $this-&gt;cc_number; if($method-&gt;payment_params-&gt;ask_ccv){ $this-&gt;cc_CCV = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.cc_CCV'); if(!empty($this-&gt;cc_CCV)){ $this-&gt;cc_CCV = base64_decode($this-&gt;cc_CCV); } $vars["x_card_code"] = $this-&gt;cc_CCV; } $vars["x_exp_date"] = $this-&gt;cc_month.$this-&gt;cc_year; $vars["x_tran_key"] = $method-&gt;payment_params-&gt;transaction_key; $post_string = ""; foreach( $vars as $key =&gt; $value ){ if(is_array($value)){ foreach($value as $v){ $post_string .= "$key=" . urlencode( $v ) . "&amp;"; } }else{ $post_string .= "$key=" . urlencode( $value ) . "&amp;"; } } $post_string = rtrim( $post_string, "&amp; " ); $request = curl_init($method-&gt;payment_params-&gt;url); curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); if(empty($post_response)){ $app-&gt;enqueueMessage('The connection to the payment plateform did not succeed. It is often caused by the hosting company blocking external connections so you should contact him for further guidance. The cURL error message was: '.curl_error($request),'error'); return false; } curl_close ($request); $response_array = explode("&#124;",$post_response); $response_code = (int)@$response_array[0]; $response_subcode = @$response_array[1]; $response_reason_code = @$response_array[2]; $response_reason_text = @$response_array[3]; $this-&gt;response_code = $response_code; switch($response_code) { case 2: $app-&gt;enqueueMessage(JText::_('TRANSACTION_DECLINED_WRONG_CARD')); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_number',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_month',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_year',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_CCV',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_owner',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_valid',0); $do = false; break; case 3: default: $app-&gt;enqueueMessage(JText::sprintf('TRANSACTION_PROCESSING_ERROR',$response_reason_code.' '.$response_reason_text)); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_number',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_month',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_year',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_CCV',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_owner',''); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.cc_valid',0); $do = false; break; case 1: $order-&gt;history-&gt;history_reason=JText::sprintf('AUTOMATIC_PAYMENT_NOTIFICATION'); $order-&gt;history-&gt;history_notified=0; $order-&gt;history-&gt;history_amount= round($order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,2).'USD'; $order-&gt;history-&gt;history_payment_id = $order-&gt;order_payment_id; $order-&gt;history-&gt;history_payment_method =$order-&gt;order_payment_method; $order-&gt;history-&gt;history_data = ''; $order-&gt;history-&gt;history_type = 'payment'; $order-&gt;order_status = $method-&gt;payment_params-&gt;verified_status; break; case 4: $order-&gt;history-&gt;history_reason=JText::sprintf('AUTOMATIC_PAYMENT_NOTIFICATION'); $order-&gt;history-&gt;history_notified=0; $order-&gt;history-&gt;history_amount= round($order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,2).'USD'; $order-&gt;history-&gt;history_payment_id = $order-&gt;order_payment_id; $order-&gt;history-&gt;history_payment_method =$order-&gt;order_payment_method; $order-&gt;history-&gt;history_data = ''; $order-&gt;history-&gt;history_type = 'payment'; $order-&gt;order_status = $element-&gt;payment_params-&gt;pending_status; break; } return true; } function onAfterOrderCreate(&amp;$order,&amp;$send_email){ $app =&amp; JFactory::getApplication(); if($app-&gt;isAdmin()){ return true; } if($order-&gt;order_payment_method!='authorize'){ return true; } $db = JFactory::getDBO(); $query = 'SELECT * FROM '.hikashop_table('payment').' WHERE payment_type='.$db-&gt;Quote($order-&gt;order_payment_method); $db-&gt;setQuery($query); $paymentData = $db-&gt;loadObjectList('payment_id'); $pluginsClass = hikashop_get('class.plugins'); $pluginsClass-&gt;params($paymentData,'payment'); $method =&amp; $paymentData[$order-&gt;order_payment_id]; if(@$method-&gt;payment_params-&gt;api!='aim'){ return true; } if(!empty($this-&gt;response_code)){ switch($this-&gt;response_code){ case 1: $mailer = JFactory::getMailer(); $config =&amp; hikashop_config(); $sender = array( $config-&gt;get('from_email'), $config-&gt;get('from_name') ); $mailer-&gt;setSender($sender); $mailer-&gt;addRecipient(explode(',',$config-&gt;get('payment_notification_email'))); $url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&amp;ctrl=order&amp;task=listing'; $order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$order-&gt;order_number,HIKASHOP_LIVE); $order_text .= "\r\n".str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url)); $mailer-&gt;setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Authorize.net','Accepted',$order-&gt;order_number)); $body = str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Authorize.net','Accepted')).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order-&gt;order_status)."\r\n\r\n".$order_text; $mailer-&gt;setBody($body); $mailer-&gt;Send(); break; case 4: $mailer = JFactory::getMailer(); $config =&amp; hikashop_config(); $sender = array( $config-&gt;get('from_email'), $config-&gt;get('from_name') ); $mailer-&gt;setSender($sender); $mailer-&gt;addRecipient(explode(',',$config-&gt;get('payment_notification_email'))); $url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&amp;ctrl=order&amp;task=listing'; $order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$order-&gt;order_number,HIKASHOP_LIVE); $order_text .= "\r\n".str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url)); $mailer-&gt;setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Authorize.net','Pending',$order-&gt;order_number)); $body = str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Authorize.net','Pending')).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order-&gt;order_status)."\r\n\r\n".$order_text; $mailer-&gt;setBody($body); $mailer-&gt;Send(); break; } } } function _loadStandardVars(&amp;$order,&amp;$method){ $tax_total = ''; $discount_total = ''; $currencyClass = hikashop_get('class.currency'); $currencies=null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency=$currencies[$order-&gt;order_currency_id]; $user = hikashop_loadUser(true); $debug = $method-&gt;payment_params-&gt;debug; $vars = Array( "x_amount" =&gt; round($order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,(int)$currency-&gt;currency_locale['int_frac_digits']), "x_version" =&gt; '3.1', "x_test_request" =&gt; $debug, ); $vars["x_relay_response"] = 'FALSE'; $vars["x_customer_ip"] = $order-&gt;order_ip; /* if(!isset($this-&gt;element-&gt;payment_params-&gt;capture))$this-&gt;element-&gt;payment_params-&gt;capture=1; if($this-&gt;element-&gt;payment_params-&gt;capture){ $vars["x_type"] = 'AUTH_CAPTURE'; }else{ $vars["x_type"] = 'AUTH_ONLY'; } */ $vars["x_type"] = 'AUTH_ONLY'; // Removed config option and just use the one needed $vars["x_login"] = $method-&gt;payment_params-&gt;login_id; if(!empty($order-&gt;order_id)){ $vars["x_invoice_num"] = $order-&gt;order_id; $vars["x_po_num"] = $vars["x_invoice_num"]; } $vars["x_email"]=$user-&gt;user_email; $app =&amp; JFactory::getApplication(); $cart = hikashop_get('class.cart'); $address=$app-&gt;getUserState( HIKASHOP_COMPONENT.'.billing_address'); if(!empty($address)){ $cart-&gt;loadAddress($order-&gt;cart,$address,'object','billing'); $vars["x_first_name"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_firstname,0,50); $vars["x_last_name"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_lastname,0,50); $vars["x_address"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_street,0,60); $vars["x_company"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_company,0,50); $vars["x_country"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_country-&gt;zone_name_english,0,60); $vars["x_zip"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_post_code,0,20); $vars["x_city"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_city,0,40); $vars["x_state"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_state-&gt;zone_name_english,0,40); $vars["x_phone"]=substr(@$order-&gt;cart-&gt;billing_address-&gt;address_telephone,0,25); } $address=$app-&gt;getUserState( HIKASHOP_COMPONENT.'.shipping_address'); if(!empty($address)){ $cart-&gt;loadAddress($order-&gt;cart,$address,'object','shipping'); $vars["x_ship_to_first_name"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_firstname,0,50); $vars["x_ship_to_last_name"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_lastname,0,50); $vars["x_ship_to_address"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_street,0,60); $vars["x_ship_to_company"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_company,0,50); $vars["x_ship_to_country"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_country-&gt;zone_name_english,0,60); $vars["x_ship_to_zip"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_post_code,0,20); $vars["x_ship_to_city"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_city,0,40); $vars["x_ship_to_state"]=substr(@$order-&gt;cart-&gt;shipping_address-&gt;address_state-&gt;zone_name_english,0,40); } $i = 1; $tax = 0; $vars["x_line_item"]=array(); foreach($order-&gt;cart-&gt;products as $product){ if(bccomp($product-&gt;order_product_tax,0,5)){ $tax+=$product-&gt;order_product_quantity*round($product-&gt;order_product_tax,(int)$currency-&gt;currency_locale['int_frac_digits']); $has_tax = 'TRUE'; }else{ $has_tax = 'FALSE'; } $vars["x_line_item"][]=substr($product-&gt;order_product_code,0,30).'&lt;&#124;&gt;'.substr(strip_tags($product-&gt;order_product_name),0,30).'&lt;&#124;&gt;&lt;&#124;&gt;'.$product-&gt;order_product_quantity.'&lt;&#124;&gt;'.round($product-&gt;order_product_price,(int)$currency-&gt;currency_locale['int_frac_digits']).'&lt;&#124;&gt;'.$has_tax; } if(!empty($order-&gt;cart-&gt;coupon) &amp;&amp; @$order-&gt;cart-&gt;coupon-&gt;discount_value&gt;0){ $vars["x_line_item"][]='coupon&lt;&#124;&gt;'.JText::_('HIKASHOP_COUPON').'&lt;&#124;&gt;&lt;&#124;&gt;1&lt;&#124;&gt;'.round($order-&gt;cart-&gt;coupon-&gt;discount_value,(int)$currency-&gt;currency_locale['int_frac_digits']).'&lt;&#124;&gt;N'; } if(!empty($order-&gt;order_payment_price)){ $vars["x_line_item"][]='payment&lt;&#124;&gt;'.JText::_('HIKASHOP_PAYMENT').'&lt;&#124;&gt;&lt;&#124;&gt;1&lt;&#124;&gt;'.round($order-&gt;order_payment_price,(int)$currency-&gt;currency_locale['int_frac_digits']).'&lt;&#124;&gt;N'; } if(bccomp($tax,0,5)){ $vars['x_tax']=$tax; $vars['x_tax_exempt']='FALSE'; }else{ $vars['x_tax_exempt']='TRUE'; } if(!empty($order-&gt;order_shipping_price)){ $vars["x_freight"]=round($order-&gt;order_shipping_price,(int)$currency-&gt;currency_locale['int_frac_digits']); } return $vars; } function onAfterOrderConfirm(&amp;$order,&amp;$methods,$method_id){ $method =&amp; $methods[$method_id]; if(@$method-&gt;payment_params-&gt;api=='aim'){ $viewType='_thankyou'; global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } $return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=after_end&amp;order_id='.$order-&gt;order_id.$url_itemid; $this-&gt;removeCart = true; }else{ $method-&gt;payment_params-&gt;iframe = 1; $vars = $this-&gt;_loadStandardVars($order,$method); $viewType = '_end'; $vars["x_show_form"] = 'PAYMENT_FORM'; if(@$method-&gt;payment_params-&gt;notification){ $vars["x_relay_response"] = 'TRUE'; $lang = &amp;JFactory::getLanguage(); $locale=strtolower(substr($lang-&gt;get('tag'),0,2)); global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } $vars["x_relay_url"] = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=notify&amp;notif_payment=authorize&amp;tmpl=component&amp;lang='.$locale.$url_itemid; } $vars["x_fp_sequence"] = $vars["x_invoice_num"]; $vars["x_fp_timestamp"] = time(); $vars["x_fp_hash"] = hash_hmac("md5", $vars["x_login"] . "^" . $vars["x_fp_sequence"] . "^" . $vars["x_fp_timestamp"] . "^" . $vars["x_amount"] . "^", $method-&gt;payment_params-&gt;transaction_key); if(!empty($method-&gt;payment_params-&gt;x_logo_url)){ $vars['x_logo_url']=$method-&gt;payment_params-&gt;x_logo_url; } } if(!HIKASHOP_J30) JHTML::_('behavior.mootools'); else JHTML::_('behavior.framework'); $app =&amp; JFactory::getApplication(); $name = $method-&gt;payment_type.$viewType.'.php'; $path = JPATH_THEMES.DS.$app-&gt;getTemplate().DS.'hikashoppayment'.DS.$name; if(!file_exists($path)){ if(version_compare(JVERSION,'1.6','&lt;')){ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$name; }else{ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$method-&gt;payment_type.DS.$name; } if(!file_exists($path)){ return true; } } require($path); return true; } function onPaymentNotification(&amp;$statuses){ $pluginsClass = hikashop_get('class.plugins'); $elements = $pluginsClass-&gt;getMethods('payment','authorize'); if(empty($elements)) return JText::_('ORDER_VALID_AFTER_PAYMENT'); $element = reset($elements); global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; } $return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=after_end&amp;order_id='.@$order-&gt;order_id.$url_itemid; $vars = array(); $data = array(); $filter = JFilterInput::getInstance(); foreach($_REQUEST as $key =&gt; $value){ $key = $filter-&gt;clean($key); $value = JRequest::getString($key); $vars[$key]=$value; } $app =&amp; JFactory::getApplication(); if($element-&gt;payment_params-&gt;debug){ echo print_r($vars,true)."\n\n\n"; } if(@$element-&gt;payment_params-&gt;api=='dpm' &amp;&amp; @$_GET['iframe']){ $vars = unserialize(base64_decode($vars['iframe'])); $method =&amp; $element; if(!HIKASHOP_J30) JHTML::_('behavior.mootools'); else JHTML::_('behavior.framework'); $name = $element-&gt;payment_type.'_end.php'; }else{ $name = $element-&gt;payment_type.'_thankyou.php'; } $path = JPATH_THEMES.DS.$app-&gt;getTemplate().DS.'hikashoppayment'.DS.$name; if(!file_exists($path)){ if(version_compare(JVERSION,'1.6','&lt;')){ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$name; }else{ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$element-&gt;payment_type.DS.$name; } if(!file_exists($path)){ } } ob_start(); require($path); $msg = ob_get_clean(); if(@$element-&gt;payment_params-&gt;api=='dpm'&amp;&amp;@$_GET['iframe']){ echo $msg; ob_start(); return; } if(!$element-&gt;payment_params-&gt;notification){ echo 'Notification not activated for authorize.net'; return $msg; } $vars['x_MD5_Hash_calculated']=$this-&gt;md5Hash(@$element-&gt;payment_params-&gt;md5_hash,@$element-&gt;payment_params-&gt;login_id,@$vars['x_trans_id'],@$vars['x_amount']); if($element-&gt;payment_params-&gt;debug){ echo print_r($vars,true)."\n\n\n"; } $orderClass = hikashop_get('class.order'); $dbOrder = $orderClass-&gt;get((int)@$vars['x_po_num']); $order = new stdClass(); $order-&gt;order_id = @$dbOrder-&gt;order_id; if(!empty($dbOrder)){ $order-&gt;old_status-&gt;order_status=$dbOrder-&gt;order_status; $url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&amp;ctrl=order&amp;task=edit&amp;order_id='.$order-&gt;order_id; $order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder-&gt;order_number,HIKASHOP_LIVE); $order_text .= "\r\n".str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url)); }else{ echo "Could not load any order for your notification ".@$vars['x_po_num']; return $msg; } if($element-&gt;payment_params-&gt;debug){ echo print_r($dbOrder,true)."\n\n\n"; } $mailer = JFactory::getMailer(); $config =&amp; hikashop_config(); $sender = array( $config-&gt;get('from_email'), $config-&gt;get('from_name') ); $mailer-&gt;setSender($sender); $mailer-&gt;addRecipient(explode(',',$config-&gt;get('payment_notification_email'))); if (@$vars['x_MD5_Hash']!=$vars['x_MD5_Hash_calculated']) { $mailer-&gt;setSubject(JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Authorize.net').'invalid response'); $body = JText::sprintf("Hello,\r\n An Authorize.net notification was refused because the response from the Authorize.net server was invalid. The hash received was ".$vars['x_MD5_Hash']." while the calculated hash was ".$vars['x_MD5_Hash_calculated'].". Please cehck that you're set the same md5 hash key in Authorize.net and the plugin")."\r\n\r\n".$order_text; $mailer-&gt;setBody($body); $mailer-&gt;Send(); if($element-&gt;payment_params-&gt;debug){ echo 'invalid md5'."\n\n\n"; } return $msg; } $vars['x_response_code']=(int)@$vars['x_response_code']; if(!in_array($vars['x_response_code'],array(1,4))) { if($vars['x_response_code']==2){ $vars['payment_status']='Declined'; }else{ $vars['payment_status']='Error'; } $body = str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Authorize.net',$vars['payment_status'])).' '.JText::_('STATUS_NOT_CHANGED')."\r\n\r\n".$order_text; $mailer-&gt;setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Authorize.net',$vars['payment_status'],$dbOrder-&gt;order_number)); $mailer-&gt;setBody($body); $mailer-&gt;Send(); if($element-&gt;payment_params-&gt;debug){ echo 'payment with code '.@$vars['x_response_code'].' : '.@$vars['x_response_reason_text']."\n\n\n"; } return $msg; } $order-&gt;history-&gt;history_reason=JText::sprintf('AUTOMATIC_PAYMENT_NOTIFICATION'); $order-&gt;history-&gt;history_notified=0; $order-&gt;history-&gt;history_amount=@$vars['x_amount'].'USD'; $order-&gt;history-&gt;history_payment_id = $element-&gt;payment_id; $order-&gt;history-&gt;history_payment_method =$element-&gt;payment_type; $order-&gt;history-&gt;history_data = ob_get_clean(); $order-&gt;history-&gt;history_type = 'payment'; $price_check = round($dbOrder-&gt;order_full_price, 2 ); if($price_check != @$vars['x_amount']){ $order-&gt;order_status = $element-&gt;payment_params-&gt;invalid_status; $orderClass-&gt;save($order); $mailer-&gt;setSubject(JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Authorize.net').JText::_('INVALID_AMOUNT')); $body = str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('AMOUNT_RECEIVED_DIFFERENT_FROM_ORDER','Authorize.net',$order-&gt;history-&gt;history_amount,$price_check.'USD'))."\r\n\r\n".$order_text; $mailer-&gt;setBody($body); $mailer-&gt;Send(); return $msg; } if($vars['x_response_code']==1){ $order-&gt;order_status = $element-&gt;payment_params-&gt;verified_status; $vars['payment_status']='Accepted'; }else{ $order-&gt;order_status = $element-&gt;payment_params-&gt;pending_status; $order_text =@$vars['x_response_reason_text']."\r\n\r\n".$order_text; $vars['payment_status']='Pending'; } $config =&amp; hikashop_config(); if($config-&gt;get('order_confirmed_status','confirmed')==$order-&gt;order_status){ $order-&gt;history-&gt;history_notified=1; } $mailer-&gt;setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Authorize.net',$vars['payment_status'],$dbOrder-&gt;order_number)); $body = str_replace('&lt;br/&gt;',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Authorize.net',$vars['payment_status'])).' '.JText::sprintf('ORDER_STATUS_CHANGED',$statuses[$order-&gt;order_status])."\r\n\r\n".$order_text; $mailer-&gt;setBody($body); $mailer-&gt;Send(); $orderClass-&gt;save($order); return $msg; } function onPaymentConfiguration(&amp;$element){ $subtask = JRequest::getCmd('subtask',''); $this-&gt;authorize = JRequest::getCmd('name','authorize'); if(empty($element)){ $element = new stdClass(); $element-&gt;payment_name='Authorize'; $element-&gt;payment_description='You can pay by credit card using this payment method'; $element-&gt;payment_images='MasterCard,VISA,Credit_card,American_Express'; $element-&gt;payment_type=$this-&gt;authorize; $element-&gt;payment_params=new stdClass(); $element-&gt;payment_params-&gt;url='https://secure.authorize.net/gateway/transact.dll'; $element-&gt;payment_params-&gt;api='sim'; $element-&gt;payment_params-&gt;invalid_status='cancelled'; $element-&gt;payment_params-&gt;pending_status='created'; $element-&gt;payment_params-&gt;verified_status='confirmed'; $element = array($element); } $this-&gt;toolbar = array( 'save', 'apply', 'cancel', '&#124;', array('name' =&gt; 'pophelp', 'target' =&gt;'payment-authorize-form') ); hikashop_setTitle('Authorize','plugin','plugins&amp;plugin_type=payment&amp;task=edit&amp;name='.$this-&gt;authorize); $app = JFactory::getApplication(); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.payment_plugin_type', $this-&gt;authorize); $this-&gt;address = hikashop_get('type.address'); $this-&gt;category = hikashop_get('type.categorysub'); $this-&gt;category-&gt;type = 'status'; } function onPaymentConfigurationSave(&amp;$element){ return true; } function md5Hash($md5Hash, $login_id, $trans_id, $amount) { if ($amount == '' &#124;&#124; $amount == '0'){ $amount = '0.00'; } return strtoupper(md5($md5Hash.$login_id.$trans_id.$amount)); } } if(!function_exists('hash_hmac')){ function hash_hmac($algo, $data, $key, $raw_output = false){ $algo = strtolower($algo); $pack = 'H'.strlen($algo('test')); $size = 64; $opad = str_repeat(chr(0x5C), $size); $ipad = str_repeat(chr(0x36), $size); if (strlen($key) &gt; $size) { $key = str_pad(pack($pack, $algo($key)), $size, chr(0x00)); } else { $key = str_pad($key, $size, chr(0x00)); } for ($i = 0; $i &lt; strlen($key) - 1; $i++) { $opad[$i] = $opad[$i] ^ $key[$i]; $ipad[$i] = $ipad[$i] ^ $key[$i]; } $output = $algo($opad.pack($pack, $algo($ipad.$data))); return ($raw_output) ? pack($pack, $output) : $output; } }

**authorize\_configuration.php file:**
No modifications were made to this file. I figured that I would hardcode any parameters I wanted into the authorize.php file.

**authorize\_end.php**
Nothing to really change in this file. This file seems to just gather the fields and values and sends it off to the authorize.net/PnP emulator.

**authorize\_thankyou.php**
No changes made to this file. I made my changes to checkout/after_end.php file for my ending displays.

I figure my next step is to add the code that will get the currency from HikaShop and then define "x_currency_code" with the currency.

I know I'll need to add this code to a conditional statement Code:

if ($currency == "JMD"){ $vars["x_currency_code"] = 'JMD'; }else{ $vars["x_currency_code"] = 'USD'; }

How would I get the plugin to grab the currency from HikaShop?

Like you said, maybe the PnP emulator only accept USD from the authorize plugin, but it's worth a try. The only alternative would be to write a proper plugin for PnP and I'll need a lot more help with this.

Any input will be appreciated and thank you in advanced.

Last edit: 13 years 8 months ago by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile").

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#89311](#89311) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89311 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Can someone tell me please if I'm on the right track with this?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzc4MDQzLW5vLXBheW1lbnQtbWVudGhvZD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

13 years 8 months ago [\#89568](#89568) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89568 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

That's sounds worth a try yes. You can add that code to add the x_currency_code : Code:

$currencyClass = hikashop_get('class.currency'); $currencies = null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency = $currencies[$order-&gt;order_currency_id]; $vars["x_currency_code"] = $currency-&gt;currency_code;

Let us know how that goes and if it's ok, we could add it in the next version of the authorize.net plugin.

We actually have lot of payment plugins from which you can take example from. HikaShop ships with more than 20. So you can simply look in them to see how we did if you want to create a new one ![:)](/media/kunena/emoticons/8.png ":)") The files are in the folder plugins/hikashoppayment

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#89580](#89580) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89580 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Thank you very much Nicolas. I will give it a try and let you know how it turns out.

Like I said before, I'm not really a coder, but I do plan on giving a proper plugin for Plug 'n Pay a try, but after I'm done with this project. I know I will need help, but if it works well I will be happy to share with the HikaShop community.

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#89582](#89582) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89582 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Just a quick question.

I found that this code is already there. Code:

$currencyClass = hikashop_get('class.currency'); $null=null; $currency_id = intval(@$order-&gt;total-&gt;prices[0]-&gt;price_currency_id); $currency = $currencyClass-&gt;getCurrencies($currency_id,$null); if(!empty($currency) &amp;&amp; @$currency[$currency_id]-&gt;currency_code != 'USD'){ return true; }

Should I replace it with the one you gave me? Or just add your code below this one.

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#89680](#89680) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#89680 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

I think that you can just try to add the line: Code:

$vars["x_currency_code"] = $currency[$currency_id]-&gt;currency_code;

Before: Code:

if(!empty($currency) &amp;&amp; @$currency[$currency_id]-&gt;currency_code != 'USD'){ return true; }

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

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

Less More

- Posts: 31
- Thank you received: 10
-
-

13 years 8 months ago [\#90506](#90506) by [trueblue](/forum/user/7538-trueblue "View trueblue's Profile")  Replied by *[trueblue](/forum/user/7538-trueblue "View trueblue's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#90506 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Ok.. It seems that the codes Nicolas gave worked. It allowed the plugin to work with JMD.

Here are the codes I used:
Code:

/* // Replaced with the codes below $currencyClass = hikashop_get('class.currency'); $null=null; $currency_id = intval(@$order-&gt;total-&gt;prices[0]-&gt;price_currency_id); $currency = $currencyClass-&gt;getCurrencies($currency_id,$null); if(!empty($currency) &amp;&amp; @$currency[$currency_id]-&gt;currency_code != 'USD'){ return true; } */ // Modified to accept JMD. This will allow the plugin to send a currency value to the gateway. // By default it assumes USD if no currency value is sent. $currencyClass = hikashop_get('class.currency'); $currencies = null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency = $currencies[$order-&gt;order_currency_id]; $vars["x_currency_code"] = $currency-&gt;currency_code;

However, it can't work for me as I'm using the Authorize.net plugin for Plug 'n Pay via PnP's emulator. Authorize does not support the "Rate" value and so the emulator is not looking for it. Be default the currency is assumed to be in USD, so sending a currency value is only optional.

Anyways, now I'm going to have to create a dedicated plugin for Plug 'n Pay. And one that will work with JMD. It seems they have partnered with one of our (Jamaica) local bank, NCB to allow JMD currency. So, this plugin has to be developed with this in mind.

Like I said before is my previous posts, I'm not really a developer. In fact, I'm really just a designer. However, I do know my way around a bit and is somewhat capable of figuring out stuff. And so, I will need a lot of help with this.

I'm going to start with copying some codes from another payment plugin and then try to add the PnP data requirements to it. I will post it here for your review with the hopes that if I'm doing something wrong, someone can point it out to me.

Thank you for your help so far.

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

- **[winchester](/forum/user/6696-winchester "View winchester's Profile")**
- [![winchester's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6696.jpg)](/forum/user/6696-winchester "View winchester's Profile")
- [ Offline](/forum/user/6696-winchester)

Less More

- Posts: 14
- Thank you received: 4
-
-
-

13 years 8 months ago [\#91448](#91448) by [winchester](/forum/user/6696-winchester "View winchester's Profile")  Replied by *[winchester](/forum/user/6696-winchester "View winchester's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#91448 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Ok... I added the code to the **onPaymentDisplay** function:
Code:

/* // Replaced with the codes below $currencyClass = hikashop_get('class.currency'); $null=null; $currency_id = intval(@$order-&gt;total-&gt;prices[0]-&gt;price_currency_id); $currency = $currencyClass-&gt;getCurrencies($currency_id,$null); if(!empty($currency) &amp;&amp; @$currency[$currency_id]-&gt;currency_code != 'USD'){ return true; } */ // Modified to accept JMD. This will allow the plugin to send a currency value to the gateway. // By default it assumes USD if no currency value is sent. $currencyClass = hikashop_get('class.currency'); $currencies = null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency = $currencies[$order-&gt;order_currency_id]; $vars["x_currency_code"] = $currency-&gt;currency_code;

And this allows the plugin for display when the currency is changed to JMD via the switcher. It worked fine and even sends to the emulator/payment gateway fine. The only issue now left to resolve is that it's not sending the currency attribute to the emulator/payment gateway.

I looked at the code further down the page and realize that there was another function that handled the preparation of the data for the payment gateway attributes. So, I'm thinking... I should repeat the code below somewhere in that function, right?
Code:

function _loadStandardVars(&amp;$order,&amp;$method){ $tax_total = ''; $discount_total = ''; $currencyClass = hikashop_get('class.currency'); $currencies=null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency=$currencies[$order-&gt;order_currency_id]; $vars["x_currency_code"] = $currency-&gt;currency_code; // To add the currency code to the vars. ... }

I had to ask, because the testing for the Jamaican currency card is don't by the bank. I can test Visa card myself for USD (which is working fine), but I didn't get one for the local cc...

BTW: TrueBlue = Me ![:)](/media/kunena/emoticons/8.png ":)")

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

- **[winchester](/forum/user/6696-winchester "View winchester's Profile")**
- [![winchester's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6696.jpg)](/forum/user/6696-winchester "View winchester's Profile")
- [ Offline](/forum/user/6696-winchester)

Less More

- Posts: 14
- Thank you received: 4
-
-
-

13 years 8 months ago [\#91483](#91483) by [winchester](/forum/user/6696-winchester "View winchester's Profile")  Replied by *[winchester](/forum/user/6696-winchester "View winchester's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#91483 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Great news!! It worked fine!! Yay!!

Ok.. Just one last thing now. The site can now accept 3 CC brands; Visa &amp; MasterCard for USD Only and KeyCard for JMD only. I'm thinking I need a way to ensure that Visa &amp; MasterCard only are accepted when the site is showing USD and KeyCard only when the site is showing JMD.

Now I'm thinking that the most obvious way to do this is to duplicate the payment plugin and have set them for each of the available cards/currencies accordingly.

Is there a better way to handle this? Or duplicating the plugin is the best way?

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#91650](#91650) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[No Payment Menthod?](/forum/4-how-to/78043-no-payment-menthod#91650 "Hi,  I have 2 currency set up, USD and JMD with USD as the main. My payment gateway accepts both currencies.  At checkout, when everything is in USD everything show up and works fine, checkout and all. When I switch using the Currency Switcher to JMD, everything converts and shows JMD fine, but when I go to checkout, the payment method doesn't show.  When I switch back to USD the payment method shows. I have no zone restrictions on the payment method. Any idea how to fix this?  Any help would be greatly appreciated. Thanks in advance.")*

Hi,

I think that you have to duplicate the plugins.
When duplicating don't forget to rename all the instance of the plugin name in the php and xml files.

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

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

[](#top)
