I have tried this below code in catalog/controller/payment/pp_standard.php
. it works fine. For example, My product rate is 2450 INR. When I choose paypal option it would convert the INR rate into USD rate and then it would redirect to paypal.com successfully.
But, I have enabled paypal express checkout also. So, When I choose paypal express checkout option it doesn't redirect to paypal.com. because of currency problem (I get currency is not supporrted error). How do I convert the INR currency to USD currency before passing to paypal in opencart?
Note : I need a solution for Paypal Express Checkout catalog/controller/payment/pp_express.php
& catalog/model/payment/pp_express.php
$currencies = array(
'AUD',
'CAD',
'EUR',
'GBP',
'JPY',
'USD',
'NZD',
'CHF',
'HKD',
'SGD',
'SEK',
'DKK',
'PLN',
'NOK',
'HUF',
'CZK',
'ILS',
'MXN',
'MYR',
'BRL',
'PHP',
'TWD',
'THB',
'TRY'
);
if (!in_array(strtoupper($this->currency->getCode()), $currencies))
{
$order_info['currency_code'] = 'USD';
}
Applying the same code after:
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
and adding one extra line,
$order_info['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], false, false);
should work just fine.
PS. I have not tested it, but you should be fine :D
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.