Magento – Convert the price from Base Currency to USD at the stage of paypal payment

conversioncurrencymagento-1.9paypal

I have integrated PayPal to my website and PayPal does not support Base currency INR and support if Base Currency US Dollar.

Partial Working Method:

app\code\core\Mage\Paypal\Model\Express\Checkout.php

$this->_api->setAmount($this->_quote->getBaseGrandTotal())
            ->setCurrencyCode($this->_quote->getBaseCurrencyCode())
            ->setInvNum($this->_quote->getReservedOrderId())
            ->setReturnUrl($returnUrl)
            ->setCancelUrl($cancelUrl)
            ->setSolutionType($solutionType)
            ->setPaymentAction($this->_config->paymentAction);

Just replace the below code:

$this->_api->setAmount($this->_quote->getBaseGrandTotal())
            ->setCurrencyCode('USD')
            ->setInvNum($this->_quote->getReservedOrderId())
            ->setReturnUrl($returnUrl)
            ->setCancelUrl($cancelUrl)
            ->setSolutionType($solutionType)
            ->setPaymentAction($this->_config->paymentAction);

this one is working but the price Rs.70 displayed like $70 at my PayPal payment page. How to solve this issue?

How to convert the price from Base Currency to USD at PayPal payment?

Best Answer

Magento has a lot of functionality to convert currency. It is designed as a multi-lingual and multi-currency application.

The easiest way to convert from the base currency into the current selected store currency is with the following code:

$amount = Mage::app()->getStore()->convertPrice($baseAmount, false, false);

You can also use the directory helper:

/* @var $helper Mage_Directory_Helper_Data */
$helper = Mage::helper('directory');

// second param = 'from', third param = 'to'
$amount = $helper->currencyConvert($amount, 'USD', 'EUR');

To make sure your currency exchange rates are up to date, you need to enable cron for the magento website and make sure that the schedule imports are enabled:

Magento Admin > System Config > Currency Setup > Scheduled Import Settings

To answer the specific question about Paypal, look at this link.

Related Topic