【问题标题】:PayPal for Indian Rupees (INR) any solution印度卢比 (INR) 的 PayPal 任何解决方案
【发布时间】:2010-04-14 04:45:28
【问题描述】:

我正在开发在线购物网站,在购物网站上,所有产品的价格都以印度卢比 (INR) 为单位。我要将我的购物车集成到 PayPal 支付网关。 我知道 PayPal 不支持 INR。所以我必须将 INR 转换为 USD。 是否有任何 API 服务可以自动将 INR 转换为 USD?,
如果有,请提供有关详细信息...

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    您可以使用 Google 计算器 API。

    这是一个 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】:

    【讨论】:

      【解决方案3】:

      我认为您不需要为 Paypal 将 INR 转换为 USD:(如果您使用的是 woocommerce)

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

      【讨论】:

        猜你喜欢
        • 2011-12-25
        • 2015-12-31
        • 2018-12-12
        • 2012-07-29
        • 2014-12-09
        • 2023-04-06
        • 2015-10-25
        • 2019-05-08
        • 1970-01-01
        相关资源
        最近更新 更多