Our primary currency is USD, and what I believe is happening is the OrderTotal (in USD) is being sent along with the foreign currency code, which PayPal then interprets that amount in the foreign currency. Code snippets below.
For example, this morning's order total was $21.82 USD and customer paid €18.44 EUR. Trying to refund in full results in this error: "The partial refund amount must be less than or equal to the remaining amount". I can only assume that PayPal interprets the refundRequest.Amount as €21.82 EUR.
Am I right in one of these approaches?
1) Override the Refund method in OrderProcessingService to convert OrderTotal to the foreign currency before assigning it to request.AmountToRefund
2) Override the Refund method in PayPal's ServiceManager to always use the store's default currency (this is how it's done in Authorize.net : currencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode). I anticipate that PayPal expects the amount in the currency paid though, so 1) above is probably preferable.
3) Add all the foreign currencies to our PayPal account since we currently only have USD setup : https://www.paypal.com/businesswallet/addcurrency
(though it's not clear to me what they mean by "balance" in their description "When you add a currency, any payments you receive in that currency will be credited to that balance")
code snippets:
orderProcessingService.Refund
var request = new RefundPaymentRequest();
try
{
request.Order = order;
request.AmountToRefund = order.OrderTotal;
request.IsPartialRefund = false;
result = _paymentService.Refund(request);
if (result.Success) ...
PayPal's paymentMethod.Refund
var amount = refundPaymentRequest.AmountToRefund != refundPaymentRequest.Order.OrderTotal
? (decimal?)refundPaymentRequest.AmountToRefund
: null;
var (refund, error) = _serviceManager.Refund(refundPaymentRequest.Order.CaptureTransactionId, refundPaymentRequest.Order.CustomerCurrencyCode, amount);