white-nl / commerce-mollie-plus

Mollie Klarna integration for Craft Commerce
Other
3 stars 4 forks source link

Use order reference instead of order number, like the original plugin #1

Closed rbrv closed 2 years ago

rbrv commented 2 years ago

First of all, great work on the new plugin!

While implementing, we came across the following:

The original Mollie plugin sent the Craft Commerce Order reference to Mollie. This order reference can be customised in the Craft Commerce System settings (Screenshot)

The new plugin uses the Order number, which is not customisable. Can this be changed? This would align it more with the original plugin, making it an easy replacement.

Mollie payments old plugin, with custom order reference Mollie payments new plugin with order number
Screenshot 2022-01-28 at 14 18 25 Screenshot 2022-01-28 at 14 18 54
WHITE-developer commented 2 years ago

The original plugin doesn’t use order reference in this case. It uses order element ID, which in your specific case matches the order reference.

Order number is safer to use than the element ID when you send data to an external system. Especially when the system may print some invoices (like in case of Klarna) where this ID may be shown. Craft recommends to use order numbers, not element IDs, anywhere where it gets displayed to the end user.

Using references would be a nicer solution, but it’s impossible to implement unless Craft changes the way it generates the references. Craft generates the references only after the order checkout is completed (including the payment process). Some shops use dates or separate sequencers for their order references. So even if we try to generate the reference at the moment we push the data to Mollie, it won’t be saved in Craft and we would end up with references that don’t match the Craft version.

rbrv commented 2 years ago

Thanks for making this clear! We've added a workaround that should be backwards compatible and created a pull-request here: #3