I am developing online shopping website, In shopping website all product priced are in Indian Rupees (INR). I am going to integrate My shopping cart to PayPal payment gateway. I knew that PayPal does not support INR. So I have to convert INR to USD. Is there any API service to convert INR to USD as automatically?,
If yes, Please give the details about that...
我正在开发网上购物网站,在购物网站上所有产品的价格均为印度卢比(INR)。我打算将我的购物车集成到PayPal支付网关。我知道PayPal不支持INR。所以我必须将INR兑换成美元。是否有任何API服务可以自动将INR转换为USD?如果是,请提供有关的详细信息......
3 个解决方案
#1
8
You can use the Google calculator API.
您可以使用Google计算器API。
Here is a PHP example:
这是一个PHP示例:
function currency_converter($from_Currency,$to_Currency,$amount) {
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$ch = curl_init();
$timeout = 0;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('"', $rawdata);
$data = explode(' ', $data['3']);
$var = $data['0'];
return round($var,2);
}
#2
5
You can take a look at: http://www.programmableweb.com/api/currency-rates
您可以查看:http://www.programmableweb.com/api/currency-rates
#3
1
I think you didn't need to convert INR to USD for Paypal:(If you are using woocommerce)
我认为您不需要将INR兑换成美元用于Paypal :(如果您使用的是woocommerce)
Write a simple code in function.php file
在function.php文件中写一个简单的代码
add_filter( 'woocommerce_paypal_supported_currencies', 'add_paypal_valid_currency' );
function add_paypal_valid_currency( $currencies ) {
array_push ( $currencies , 'INR' ); // ADD YOUR DESIRE CURRENCY
return $currencies;
}
#1
8
You can use the Google calculator API.
您可以使用Google计算器API。
Here is a PHP example:
这是一个PHP示例:
function currency_converter($from_Currency,$to_Currency,$amount) {
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$ch = curl_init();
$timeout = 0;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('"', $rawdata);
$data = explode(' ', $data['3']);
$var = $data['0'];
return round($var,2);
}
#2
5
You can take a look at: http://www.programmableweb.com/api/currency-rates
您可以查看:http://www.programmableweb.com/api/currency-rates
#3
1
I think you didn't need to convert INR to USD for Paypal:(If you are using woocommerce)
我认为您不需要将INR兑换成美元用于Paypal :(如果您使用的是woocommerce)
Write a simple code in function.php file
在function.php文件中写一个简单的代码
add_filter( 'woocommerce_paypal_supported_currencies', 'add_paypal_valid_currency' );
function add_paypal_valid_currency( $currencies ) {
array_push ( $currencies , 'INR' ); // ADD YOUR DESIRE CURRENCY
return $currencies;
}