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

#   Currency convertion on payment plugin

##

- **[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")**
- [![ghiamar's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30361.png)](/forum/user/30361-ghiamar "View ghiamar's Profile") Topic Author
- [ Offline](/forum/user/30361-ghiamar)

Less More

- Posts: 14
- Thank you received: 2
-
-
-
- [](http://www.mgscreativa.com/en/online-store)
-

10 years 6 months ago -  10 years 6 months ago [\#237424](#237424) by [ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")  *[Currency convertion on payment plugin](/forum/31-development/883998-currency-convertion-on-payment-plugin#237424 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.6.20 -- Browser(s) name and version -- : firefox 45 -- Error-message(debug-mod must be tuned on) -- : none  Hi, I have developed a payment plugin for south american MercadoPago gateway, and I wonder if I can convert the currency of the whole cart to the currency expected by the gateway, that differs from the cart currency.  IE: I have a product valued u$s10 but if I choose MercadoPago payment I expect that value to be converted to BRL for example, which is $35 BRL. Is that possible using the built in currency converter?  Thanks in advise")* was created by *[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")*

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.6.20
-- Browser(s) name and version -- : firefox 45
-- Error-message(debug-mod must be tuned on) -- : none

Hi, I have developed a payment plugin for south american MercadoPago gateway, and I wonder if I can convert the currency of the whole cart to the currency expected by the gateway, that differs from the cart currency.

IE: I have a product valued u$s10 but if I choose MercadoPago payment I expect that value to be converted to BRL for example, which is $35 BRL. Is that possible using the built in currency converter?

Thanks in advise

Last edit: 10 years 6 months ago by [ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4Mzk5OC1jdXJyZW5jeS1jb252ZXJ0aW9uLW9uLXBheW1lbnQtcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

10 years 6 months ago [\#237430](#237430) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Currency convertion on payment plugin](/forum/31-development/883998-currency-convertion-on-payment-plugin#237430 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.6.20 -- Browser(s) name and version -- : firefox 45 -- Error-message(debug-mod must be tuned on) -- : none  Hi, I have developed a payment plugin for south american MercadoPago gateway, and I wonder if I can convert the currency of the whole cart to the currency expected by the gateway, that differs from the cart currency.  IE: I have a product valued u$s10 but if I choose MercadoPago payment I expect that value to be converted to BRL for example, which is $35 BRL. Is that possible using the built in currency converter?  Thanks in advise")*

Hi,

Yes. Usually what you do is that you disable the USD currency but keep it displayed and configure BRL as the main currency. That way, when the customer browse the website with the USD currency and then arrives on the checkout, the system automatically converts the prices to BRL.

If you want to convert a price in your code using the currency converter system in place, you can do like that: Code:

$class = hikashop_get('class.currency'); $srcCurrency = $class-&gt;get('USD'); $dstCurrency = $class-&gt;get('BRL'); $convertedPrice = $class-&gt;convertUniquePrice($price, $srcCurrency-&gt;currency_id, $dstCurrency-&gt;currency_id);

The following user(s) said Thank You: [ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")

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

- **[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")**
- [![ghiamar's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30361.png)](/forum/user/30361-ghiamar "View ghiamar's Profile") Topic Author
- [ Offline](/forum/user/30361-ghiamar)

Less More

- Posts: 14
- Thank you received: 2
-
-
-
- [](http://www.mgscreativa.com/en/online-store)
-

10 years 6 months ago [\#237699](#237699) by [ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")  Replied by *[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")* on topic *[Currency convertion on payment plugin](/forum/31-development/883998-currency-convertion-on-payment-plugin#237699 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.6.20 -- Browser(s) name and version -- : firefox 45 -- Error-message(debug-mod must be tuned on) -- : none  Hi, I have developed a payment plugin for south american MercadoPago gateway, and I wonder if I can convert the currency of the whole cart to the currency expected by the gateway, that differs from the cart currency.  IE: I have a product valued u$s10 but if I choose MercadoPago payment I expect that value to be converted to BRL for example, which is $35 BRL. Is that possible using the built in currency converter?  Thanks in advise")*

Thanks! it turns out that I already applyed that code before, but for some reason it doesn't convert the ammount, just let me double check my setup and will ask if I found something.

Thanks again!

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

- **[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")**
- [![ghiamar's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30361.png)](/forum/user/30361-ghiamar "View ghiamar's Profile") Topic Author
- [ Offline](/forum/user/30361-ghiamar)

Less More

- Posts: 14
- Thank you received: 2
-
-
-
- [](http://www.mgscreativa.com/en/online-store)
-

10 years 6 months ago [\#237732](#237732) by [ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")  Replied by *[ghiamar](/forum/user/30361-ghiamar "View ghiamar's Profile")* on topic *[Currency convertion on payment plugin](/forum/31-development/883998-currency-convertion-on-payment-plugin#237732 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.6.20 -- Browser(s) name and version -- : firefox 45 -- Error-message(debug-mod must be tuned on) -- : none  Hi, I have developed a payment plugin for south american MercadoPago gateway, and I wonder if I can convert the currency of the whole cart to the currency expected by the gateway, that differs from the cart currency.  IE: I have a product valued u$s10 but if I choose MercadoPago payment I expect that value to be converted to BRL for example, which is $35 BRL. Is that possible using the built in currency converter?  Thanks in advise")*

> nicolas wrote: Hi,
>
> Code:
>
> $class = hikashop_get('class.currency'); $srcCurrency = $class-&gt;get('USD'); $dstCurrency = $class-&gt;get('BRL'); $convertedPrice = $class-&gt;convertUniquePrice($price, $srcCurrency-&gt;currency_id, $dstCurrency-&gt;currency_id);

I confirm this snippet does the trick, I already had in my payment plugin, but I have set a product with several currencyes and that was causing the issue.

Thanks a lot!

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

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

[](#top)
