The way I do this is maintain a list of exchange rates in a database table, I have a cronjob set up to grab these on an hourly basis. (From: http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml)
My products are all in USD, and I allow visitors to select from a list their preferred currency based on the conversion from USD using my exchange rates table.
So I have a table like this, listing all the currencies that Paypal accepts:
<select>
<option value="">Change Currency...</option>
<option value="USD">USD - U.S. Dollars</option>
<option value="GBP">GBP - Pounds Sterling</option>
When they select a different option I get the converted amount and display it e.g:
Ajax:
function changeCurrency(id) {
var select_price = $("#select").val();
var codes=new Array();
codes['USD']="\u0024";
codes['GBP']="\u00A3";
$.post("/payment/prices.php", { id: id, currency: select_price },
function(data){
$("#spanPrice").text(codes[select_price] + data);
$("input[name*='currency_code']").val(select_price);
if(select_price=='JPY' || select_price=='HUF'){
var splitData = data.split(".");
$("input[name*='amount']").val(splitData[0].replace(",",""));
} else {
$("input[name*='amount']").val(data.replace(",",""));
}
});
}
PHP:
function convert($amount,$from,$to,$decimals=2) {
return(number_format(($amount/$this->exchange_rates[$from])*$this->exchange_rates[$to],$decimals));
}
When it comes to payment I just take the selected currency and the converted amount. The products that I sell on my website are non-physical goods and is an automated process, so after payment is made I then do another check against the amount paid to be sure that they didn't submit for example $0.01.