1

We are using PayPal standard as an option for payments which works in the main currency (GBP) but not in any of the others eg (CAD). We're seeing in the plugin logs for craft commerce:

[Forced] Item bag total price does not equal the orders totalPrice, some payment gateways will complain.

Any ideas on what could be wrong? It seems that this is a problem with PayPal adding up the totals and seeing they are wrong? but this is all done on craft side so not too sure.

  • It looks like at the post to PayPal stage it sends GBP items and CAD total. If I force it to GBP by setting 'paymentCurrency' to GBP it works. Any ideas on how to set the right currency for line items too? – Green17 May 8 '18 at 8:27
  • Is this commerce 1 or 2-beta? – Luke Holder May 14 '18 at 8:28
  • Hi Luck, sorry did not see this comment come in. its commerce 1, craft cms 2. – Green17 May 16 '18 at 9:07
  • Please send your DB backup to support@craftcommerce.com and I will take a look. – Luke Holder May 21 '18 at 2:29
  • Hi Luke, not sure if you're getting the emails ok, with the DB back up etc can you let us know asap. – Green17 May 29 '18 at 19:29
0

Luke very helpfully got back to me to sort the problem, but in case it helps anyone else.

The immediate fix is to disable sending the item bag (cart information to PayPal) and using it purely to change the payment amount. But I will attempt to explain in full below.

You disable the cart info being sent to PayPal in your commerce.php settings with:

'sendCartInfoToGateways' => false

Strangely this is the first time we have seen this issue. But it is due to the following in Commerce:

Commerce stores all values in the system in a single base store currency. This means the cart, the discounts, shipping, and anywhere a currency amount is stored is stored as the default base currency.

The payment currency feature is purely designed to allow the charging of the order price in a different currency. The feature allows the customer to know the exact amount to be charged to their card in the currency of their card - without any surprise conversion rate determined by their bank.

Paypal, when it receives the cart information (line item prices etc) is being supplied amounts in that base currency from commerce. Paypal adds up the cart amounts and compares it to the amount that we want to charge the customer in the chosen payment currency. Obviously, the amount we are changing is in the other currency differs from this total.

At first the thought might come as a solution to convert the line items amounts to the other currency for PayPal, but this doesn't work; we do the conversion of the totalPrice of the order for the payment currency feature, and converting each line item and adding them up would usually come up with a different total due to rounding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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