As far as I have seen, the payment capture won't take place before the order gets completed. This may fit for some use cases, but definitely not for all, unless I get something wrong.

My first question is: is it enough to have an authorization to be sure the capturing will be successful later? Upon looking into Klarna docs (https://developers.klarna.com/en/de/kco-v3/order-management/delivery/) that seems ok to me. Because the most important point is that it shouldn't happen that the merchant ships the items and then sees that the payment goes wrong.

In our example, we are using the order_fulfillment_validation workflow, which means:

With custom event subscribers, we guarantuee that completed payments will automatically validate the order (so that it's state goes from validation to fulfillment). Now that the order is paid, the merchant will ship the order and manually fulfill the order in the backend, so that the order gets completed. On using commerce_klarna_payments this would mean that the capturing and hence the validation would take place afterwards, which would absolutely break our workflow.

How do you handle the order workflow?

I think, however that we are not too far away to support our use case. What I'll need is to provide an action that will trigger the order capture via Drupal backend - this would very likely make sense to have it in this module too, I'd propose. So that the merchant can initiate capturing and therefore validating the order. Immediately after this, the order can be fulfilled (shipped). When the order then gets into completed state, we only have to make sure that the capture request is not sent another time. The good thing is that Commerce order entities now already have the isPaid() function - if the order is already paid, we can also safely return before doing the capture.

So I guess, I'll at least propose a patch with the check for isPaid() inside OrderTransitionSubscriber and regarding exposing the payment capturing as Controller action, I'm awating your opinion

Comments

agoradesign created an issue. See original summary.

agoradesign’s picture

agoradesign’s picture

I'm closing my question, as I've already found out that with the help of the two referenced issues + a custom workflow transition it fits well into our workflow, and I already have more confidence about the capturing (and the Klarna workflow in general)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.