vendrhub / vendr-payment-provider-mollie

Mollie Payment Provider for Vendr, the eCommerce solution for Umbraco v8+
MIT License
0 stars 1 forks source link

Unprocessable Entity - Order line 1 is invalid. VAT amount is off. #3

Closed woldringarjan closed 3 years ago

woldringarjan commented 3 years ago

Hi Matt,

Thank you so much for implementing this Mollie Payment Provider which is widely used in The Netherlands. Awesome job!

As the title says, I do have an error while processing the payment. Testing Vendr at the moment to use as or default ecommerce solution for all projects to come. So far it's looking as a very nice product. Job well done!

Do you know how to approach this? Maybe a setting that I missed or misconfigured...

Thanks in advance! Cheers, Arjan

image

mattbrailsford commented 3 years ago

Thanks @woldringarjan

Can you share a screenshot of your order summary / line totals? Also, do you have any kind of discounts or anything applied?

It looks like something in the calculation might be slightly off.

woldringarjan commented 3 years ago

Sure! That was a quick reply :)

No discounts or anything else applied. Just testing the basics right now.

I do not have an order in Vendr. Is this enough?

image

mattbrailsford commented 3 years ago

Ok, I think I know what's going on.

Vendr currently only supports rounding prices at the unit level. So we currently calculate the price of a single unit and it's tax (both rounded to 2 decimal places) and then we multiply that by the line quantity. It sounds like on the other hand that Mollie expects rounding to occur at the line level whereby the unit price + tax is calculated (not yet rounded), multiplied by the quantity and then rounded.

I'll have to have a think what we can do here. From my research into this at the time it was "either method is legally correct as long as you apply them consistently". Quick fix might be to calculate tax differently in the provider, but then the prices in the payment gateway might be slightly different to the order. The more correct, but more complex solution is to make the rounding features of Vendr configurable so you can choose to round at the unit level or order line level (this would require some extensive testing).

One other option would be that maybe we change the Mollie provider to not bother breaking down the entire order and just send a single line item for the Mollie session that encompasses the entire order.

🤔

mattbrailsford commented 3 years ago

With regards to the last option I mention, I could switch to use the Payments API instead of the Orders API. The main downside there being you can’t use pay later options such as Klarna pay later with the Payments API. Not sure how much of a dealbreaker that is?

woldringarjan commented 3 years ago

I hear you. I'm sorry to hear that Mollie is a pain in the a$$ to implement. To be honest with you that is a dealbreaker because many clothing shops for example has a higher pay later orders like Afterpay (used a lot in the Netherlands).

mattbrailsford commented 3 years ago

Yea, I thought that would likely be the case.

Ok, then there really are only 2 options right now I think.

a) I calculate the VAT dynamically within the payment provider and it is just going to have to be different in Mollie compared to in Vendr until I can get custom rounding options added to Vendr

b) I'll just have to say the Mollie payment provider is just not workable until I can add in customizable rounding options.

Neither of which are exactly ideal

mattbrailsford commented 3 years ago

2 quick questions @woldringarjan ,

1) Can you tell me what the exact price number is you have entered into the product price field in the back office 2) Have you configured the store to say "Prices Include Tax"

mattbrailsford commented 3 years ago

Hehe, never mind, I think I have worked out exactly what the setup is.

I believe you have entered the price in the back office as being 33.55 and have the store setup such that Prices Include Tax is enabled.

Effectively then, what Vendr does is calculate the unit price as being (assuming a tax rate of 21%)

But because we round at the unit price level, it actually becomes

Which produces a line total of

Which we can see from the Mollie error is what is happening, however for Mollie, it clearly wants us to round at the line total level, which would give us a line total of

Which you can see is exactly the line Tax amount it expects.

woldringarjan commented 3 years ago

Hi Matt,

Sorry for the delay! Yes you already figured it out. Indeed exactly as you described.

Alright, good to know that the Mollie Payment Provider is not 'workable' in your opinion. I'll postpone Mollie and will get started with Buckaroo which is also used a lot in the Netherlands.

Thank you so much for looking into this so quickly and thoroughly!

Cheers, Arjan

mattbrailsford commented 3 years ago

Just to let you know, I've been looking at what it would take to have configurable rounding in Vendr 2.0 and I think I potentially have something in place. With this update you'll be able to choose how you want rounding to occur on your order, either at the Unit, Line or Total level.

With my local demo store updated to this version and the store configured to Line rounding, and with a product setup as per your setup I do indeed get the values that Mollie expects.

image

This is currently only on the v2 codebase (which is still v8 compatible) but If I do roll with it, I may just update the Mollie provider to be v2+ compatible.

woldringarjan commented 3 years ago

Hi Matt,

Thanks for the heads up! Good to see that you've made quite some progress. Very nice that rounding is configurable on unit, line or total level. Pretty neat.

I'm looking forward for the update! Thanks!

mattbrailsford commented 3 years ago

Closing this issue as this is now fixed in v2. I'll unlist the v1 package on NuGet as currently it won't work because of the above, but in v2 you can choose your rounding setting.

woldringarjan commented 3 years ago

Awesome Matt. Thanks for all your efforts!