When a customer of your website makes a payment, all payments are issued in the default currency of your site. Even if the customer selected a custom currency, when the payment is issued, it is in the default currency. The conversion between the selected currency and the default currency is calculated according to the exchange rates you set when you configure currencies. For more information, see Currencies.
To enable your customers to make payments in a currency other than the default one, you do so by overriding the way a payment request is created.
NOTE: If you, as a merchant, want to receive 10 USD for an item and configured the Euro as a currency with exchange rate 0.9 (1 USD = 0.9 Euro), then, if you enable customers to pay in the selected Euro currency, a payment request for 9 euro is issued. If you request afterwards this amount from the payment provider in USD, it is possible that the currency is converted using a different exchange rate, which may be lower – for example, 0.88 (1 USD = 0.92 Euro). As a result, you receive only 9.78 USD instead of the desired 10 USD. Therefore, you need to be aware of these currency deviations when configuring currencies and determining the exchange rate you set for a currency.
IMPORTANT: Some payment providers may not support all kind of currencies used for the particular payment operation. This is risky, as these transactions will be issued with the default currency and not with the default amount price of the order. Before performing any payment transaction, you must verify that the selected payment provider supports the selected currency. For more information, see Change currency in payment requests for PayPal Standard and WorldPay providers.
To enable customers to make payments in non-default currencies, you override the default payment currency. The following example demonstrates how to override the default way a payment request is created.
Use the following code sample:
By default, for each of properties above, the first set of properties is used. For example, Total and Tax. To create the payment request in the custom currency, you need to use the second set of sub-properties since each order has different values for both the default and the currently selected currency. For example, ExchangeRateTotal and ExchangeRateTax. Values are calculated based on the exchange rate you configured for this currency.
The following method creates a payment request in the custom currency, that is, the currency you selected. To do so, you register the CustomCurrencyOrderProcessor as the default OrderProcessor using the ObjectFactory:
In case you select PayPal Standard or WorldPay providers for payment methods, you need to apply additional code transformations because the parameters constructed for these two providers are updated if the selected currency is different than the default one. You are not required to apply these code changes when working with any of the other payment providers.
To apply the code changes, add the following code snippet into your SitefinityWebApp project:
In the code above, you set the proper price amount of the order as per the currency value of the selected payment provider.
As a final step, you need to register the providers listed above in the Sitefinity system.
IMPORTANT: To register the provider, you need to build your project first.
To register your provider:
Back To Top
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.