Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to set up a payment module on my website: US/Canada price is a certain price in USD, people other countries pay in EUR. The prices is not an exact conversion, but a "round" number which approximates exact conversion. Say, for example 140 USD and 100 EUR.

Is there an easy way to set this up in PayPal? If not, which payment method is cheap and easy to implement?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

I think you should consider if you need the approx price conversions you describe.

If you use PayPal and set the price in USD then the conversion is made by PayPal; so lets say I buy from you and you set the price in USD then I would pay PayPal with SEK (Swedish Kronor) for the value and PayPal will pay you in USD...

share|improve this answer
    
That's a business decision. It's easier to talk to Germans in rounded Euro amounts, and to Americans in round dollar amounts. Technology serves business, not the other way around. –  Philippe Nov 2 '11 at 8:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.