Currency Conversion for PayPal

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anos atrás
Hi everyone,

My default store currency is not supported by PayPal so I'm looking to convert the order total to GBP before posting to PayPal.

Does anyone know an easy way to do this? I've looked through PriceHelper.cs but none of the methods seem to do the job. Is there some other helper method somewhere that would make this easier to do?

I'm not averse to a bit of additional programming if necessary, I just need to be pointed in the right direction.

Regards
13 anos atrás
would it be possible to set your primary currency as GBP but set your store display currency to  what you need ?
13 anos atrás
Thanks for the response haydie, unfortunately your suggestion wouldn't work for my particular situation.

I need to support two different payment gateways; GTPay that supports only the NGN currency (for customers in Nigeria), and PayPal for everyone else (primarily UK & USA).

I currently have my store currency set to NGN which works well for GTPay, but not for PayPal. The solution I'm considering is to retain the store currency as NGN but convert to GBP if the user chooses PayPal.

Can you think of some other way to achieve this?

Regards.
13 anos atrás
Follow the next steps:
1. Ensure that 'PaymentMethod.PaypalStandard.ValidateOrderTotal' setting is set to 'false'
2. Find and open \Payment\Nop.Payment.PayPal\PayPalStandardPaymentProcessor.cs file
3. Find all lines of code where prices or totals are passed (e.g. 207, 225, 249, 283, etc)
4. And convert passed values from default store currency (NGN) to GBP theme (so new values converted to GBP are passed to PayPal)
13 anos atrás
a.m. wrote:
Follow the next steps:
1. Ensure that 'PaymentMethod.PaypalStandard.ValidateOrderTotal' setting is set to 'false'
2. Find and open \Payment\Nop.Payment.PayPal\PayPalStandardPaymentProcessor.cs file
3. Find all lines of code where prices or totals are passed (e.g. 207, 225, 249, 283, etc)
4. And convert passed values from default store currency (NGN) to GBP theme (so new values converted to GBP are passed to PayPal)


Great, thanks.

I'm using v1.6 and can only find one line that appears to pass a total, this is the line:

builder.AppendFormat("&amount={0}", order.OrderTotal.ToString("N", new CultureInfo("en-us")));


So
order.OrderTotal
is the amount I intend to convert to GBP. Please confirm if I'm missing something.

Also, where do I find the 'PaymentMethod.PaypalStandard.ValidateOrderTotal' setting? This setting does not appear to be in v1.6.
13 anos atrás
k4plus wrote:
So order.OrderTotal is the amount I intend to convert to GBP. Please confirm if I'm missing something

Yeah, that's right. Other amounts in this payment module were added in v1.90


k4plus wrote:
Also, where do I find the 'PaymentMethod.PaypalStandard.ValidateOrderTotal' setting? This setting does not appear to be in v1.6.

This option was added in version 1.90
13 anos atrás
All this new stuff in v1.9...I'm beginning to feel like I'm in the dark ages by using v1.6 :-).

Anyway, thanks for all your help. I have made the modifications and it works beautifully.

I don't know what else is in v1.9, but I also made the following modification in order to display prices in either the order currency or the Working Currency depending on a configuration switch:

In PriceHelper.cs:

private static bool? _FormatPriceToWorkingCurrency = null;

public static bool? FormatPriceToWorkingCurrency {
  get {
    return _FormatPriceToWorkingCurrency ?? SettingManager.GetSettingValueBoolean("Price.FormatPriceToWorkingCurrency");
  }
  set {
    _FormatPriceToWorkingCurrency = value;
  }
}


Also in PriceHelper.cs, but in FormatPrice(decimal price, bool showCurrency, Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax)

if (FormatPriceToWorkingCurrency ?? true) {
  price = CurrencyManager.ConvertCurrency(price, targetCurrency, NopContext.Current.WorkingCurrency);
  targetCurrency = NopContext.Current.WorkingCurrency;
}


This change may not fit in with the original nopCommerce paradigm for the display of prices, but for my implementation, it ensures that the customer can always see what the price is (or would be) in any currency simply by selecting the relevant currency from the Currency dropdown box; and this is consistent throughout the site.

What are your thoughts on this?
13 anos atrás
Too complex, and perhaps can cause some problems. I would just convert the price in PayPal module.
13 anos atrás
I need to do a similar thing to this.
I want to set primary store currency to USD then display and charge AUD with paypal standard.

I notice you talk about converting the totals but not changing the currency code that is passed to paypal... is that just an oversight?
13 anos atrás
zanadar wrote:
I need to do a similar thing to this.
I want to set primary store currency to USD then display and charge AUD with paypal standard.

I notice you talk about converting the totals but not changing the currency code that is passed to paypal... is that just an oversight?


I guess the assumption was that passing the correct currency code to PayPal is a given. You would indeed need to pass AUD to as the currency code to PayPal if you are converting from USD to AUD prior to redirecting to PayPal.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.