Currency conversion on the fly

I am writing an e-commerce cart and would like users to be able to perform a currency conversion into their local currency before hitting the big ‘Pay with Paypal’ button. Is there a server or function that I can integrate into my cart that can do currency conversions seamlessly without having to jump out to another currency conversion site?

Look the site here. I just saw a currency converter there. Did not download it, though.

what site micheal?

oops. Paste did not work. Here : http://tsx.nl/xojo/

Perhaps you can look at this link. Have not tried it myself, so I cannot comment on the performance.

Maybe my question should be “how do I access a Mac’s built in currency converter”?
Ho do I access the currency conversion widget inOSX?

[quote=159823:@chris benton]Maybe my question should be “how do I access a Mac’s built in currency converter”?
Ho do I access the currency conversion widget inOSX?[/quote]

I thought you were talking about a web app. Is your host a Mac ?

If your web app is on a Linux host, you could use a specialized API, such as https://openexchangerates.org/ Louis posted.

Or simply download http://www.x-rates.com/table/?from=USD&amount=1.00 with HTTPSocket and parse it to get the current rate.

I tend to think the API is a better approach.

can i use regex to get say the following from the httpsocket thingy??

 				<tr>
					<td>British Pound</td>
					<td class='rtRates'><a href='/graph/?from=USD&amp;to=GBP'>0.657465</a></td>
					<td class='rtRates'><a href='/graph/?from=GBP&amp;to=USD'>1.520994</a></td> 				
 				</tr>

basically the rate for USD to GBP or GBP to USD?

[quote=159845:@Richard Duke]can i use regex to get say the following from the httpsocket thingy??

 				<tr>
					<td>British Pound</td>
					<td class='rtRates'><a href='/graph/?from=USD&amp;to=GBP'>0.657465</a></td>
					<td class='rtRates'><a href='/graph/?from=GBP&amp;to=USD'>1.520994</a></td> 				
 				</tr>

basically the rate for USD to GBP or GBP to USD?[/quote]

Most probably. Regex can parse HTML veryefficiently, but for that particular use, you may want to check out RegExRX, the app created by Kem Tekinay to build your Regex at http://www.mactechnologies.com/index.php?page=downloads

Otherwise, you could use “instr” to find the lines containing “GBP” and “USD”, then use that index+3 to get the actual rates with Mid().

Rates very all the time and depend on who you ask. You could run into an issue if you use someone other than PayPal to obtain the rate. If it’s PayPal that is performing the transaction then it’s their current rate you need to use.

Actually, I guess what Chris wants to do is to generate the charge in a given currency according to the customer choice.

Apparently, Paypal does not provide the conversion rates the way the site mentioned above do. Here is an interesting discussion about that very topic :
http://stackoverflow.com/questions/1393385/currency-exchange-rates-for-paypal

[quote=159878:@Michel Bujardet]Actually, I guess what Chris wants to do is to generate the charge in a given currency according to the customer choice.

[/quote]
Exactly, Paypal is not even in the loop at this stage of the checkout process.