I am trying to implement multi currency to my payment gateway plugin.

I need to get converted price of the line item. Each item from Omnipay\Common\Item has the price of non converted, main price of the item.

This cause trouble because my payment gateway adds the line items and matches sum of all individual items to total sum of paid amount.

At the moment there is no multi-currency support built into Commerce.

Meaning, all prices in the system are stored in a single currency. This includes products, shipping, taxes, sales, discounts.

We DO have a multi-currency payments feature that allows a customer to pay in another currency (so they are charged an expected amount and get no surprises with their banks own conversion ratio).

The issue you are hitting above is that the price of the products is never converted. The items in the 'item bag' can only exist in the primary currency.

Your best bet is to not send the item bag to the gateway and only have them charge the amount. You can do this with the setting: sendCartInfoToGateways https://craftcommerce.com/docs/configuration#sendcartinfotogateways

If we were to try and get clever and convert the line items prices to the differing payment currency, the amount to be paid would work out to be different to the converted total, due to rounding.

When we move to full multi-currency support, this issue would go away since the line items would be converted first (along with discounts etc), and the total would be a sum of those amounts.

Hope that helps.

  • Thanks for the answer Luke. My payment gateway need the price of the each basket item price. Probably, for the partial refunds for line items. Does all other payment gateways not do this? I can't think any solution :( May be manually enter conversion ratio into plugin? Also when will be this full multi-currency support will be? Will it be in Craft 2? – orionlogic Jul 4 at 6:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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