开发者

PayPal for Indian Rupees (INR) any solution

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开发者_Go百科 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...


You can use the Google calculator API.

Here is a PHP example:

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);
}


You can take a look at: http://www.programmableweb.com/api/currency-rates


I think you didn't need to convert INR to USD for Paypal:(If you are using woocommerce)

Write a simple code in function.php file

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; 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜