Adyen / adyen-salesforce-commerce-cloud

Salesforce Commerce Cloud (formerly Demandware)
MIT License
91 stars 76 forks source link

Free product causes Klarna payment to fail #964

Closed DunkPrenatal closed 8 months ago

DunkPrenatal commented 1 year ago

Describe the bug We’re running the 22.1.0 components integration on our Sitegenesis SFCC webshop. Since recently we’ve started offering the Klarna payment method which seemed to work perfectly but there were some cases where the order failed at the create session at the Klarna side. After investigation we noticed this was because of free products (due to a BUY 3 GET 1 FREE promotion) getting a negative tax rate (this is what Klarna receives from Adyen): afbeelding Klarna did mention to us that “that the orderlines are sent as riskdata, and it is better to send them as mentioned here”. But as far as we know this is not something we set up as we use the Cartridge, we simply activated Klarna in the Adyen backend and performed no technical changes in our SFCC environment. This free-item issue also doesn’t occur with other payment methods so it really seems to relate to how Adyen’s backend communicates with the Klarna backend. Can you please investigate whether this is something that Adyen needs to fix or if we need to change our implementation?

To Reproduce Steps to reproduce the behavior:

  1. Add 4 products from the BUY 3 GET 1 FREE promotion to your basket
  2. Continue to checkout and select Klarna as payment method
  3. Try to finish and pay the order On all device types and browser versions

Expected behavior Order should be accepted.

DunkPrenatal commented 1 year ago

Our external developer on how the tax is being calculated: As far as I know, we’re not sending the tax to Adyen/Klarna per orderline. We only send the orderlines as riskdata to Adyen, without the tax. I assume the tax is calculated by Adyen in some way and sent to Klarna, or there is some data being sent some other place to Klarna by the cartridge that I don’t (yet) know about.

olga-adyen commented 8 months ago

Hi,

our team was not able to reproduce the issue on the latest available cartridge version (22.2.3). In the cartridge we send the tax amount and the amount excluding tax, then we let the platform add the tax %-age. I could recommend checking the way of setting up the promotion in your BM.

We tried it with the promotion provided by Salesforce Buy X / Get Y with the condition of buying two ties (prod. num. 682875540326M) and getting the third one (prod. num. 682875090845M) for free - it worked. The free product gets passed as a line item with 0 amount (as expected) and the payment goes through. image Apologies for a delay with the answer, hope it helps!