Unsuported Paypal Currency Conversion
-
I am trying to find out if EDD might have hooks and/or a snippet that could enable the conversion of an unsupported Paypal currency to a supported one before it is sent to Paypal for processing.
It is something that is available with Woocommerce for example:
function woocommerce_paypal_args_for_inr($paypal_args){
if ( $paypal_args[‘currency_code’] == ‘INR’){$convert_rate = getFromYahoo();
$count = 1;
while( isset($paypal_args[‘amount_’ . $count]) ){
$paypal_args[‘amount_’ . $count] = round( $paypal_args[‘amount_’ . $count] / $convert_rate, 2);
$count++;
}
$paypal_args[‘tax_cart’] = round( $paypal_args[‘tax_cart’] / $convert_rate, 2);
}
return $paypal_args;
}
add_filter(‘woocommerce_paypal_args’, ‘woocommerce_paypal_args_for_inr’);function getFromYahoo()
{
$from = ‘USD’; /*change it to your required currencies */
$to = ‘INR’;
$url = ‘http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=’. $from . $to .’=X’;
$handle = @fopen($url, ‘r’);if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}
$allData = explode(‘,’,$result); /* Get all the contents to an array */
return $allData[1];
}Any help or suggestions would be greatly appreciated
Thanks you
The topic ‘Unsuported Paypal Currency Conversion’ is closed to new replies.