Adyen and Swish gives error after creating shipment

Placing an order with Litium Adyen payment app and Swish option as payment method automatically creates a transaction of type Capture with result Pending.
When creating a shipment for the order and moving it to Processing gives the error below.

I’m guessing it’s trying to create a new/another Capture transaction. Shouldn’t it use the existing one?

2023-09-13 15:08:20.7790 [App:01] [ERROR] [.NET ThreadPool Worker] Litium.Application.Events.EventBrokerImpl - The payment (xxx) has no available amount for capture. Order id - xxx, Shipment ids - xxx
System.Exception: The payment (xxx) has no available amount for capture. Order id - xxx, Shipment ids - xxx
at Litium.Application.Sales.Factory.TransactionFactoryImpl.CreateCaptureTransactions(IEnumerable1 shipments) at Litium.Connect.Application.Erp.OrderFulfilmentServiceImpl.HandleToCreateCaptureTransactions(IEnumerable1 fulfilmentShipments, IEnumerable1 captureTransactions) at Litium.Connect.Application.Erp.OrderFulfilmentServiceImpl.Finalize(Guid orderSystemId) at Litium.Connect.Application.Erp.OrderFulfilmentServiceImpl.ProcessFulfillmentShipment(Shipment shipment) at Litium.Connect.Application.Erp.OrderFulfilmentServiceImpl.ShipmentChangedToProcessingState(Guid shipmentSystemId) at Litium.Application.Events.EventBrokerImpl.<>c__DisplayClass11_11.b__4()
at Litium.Application.Common.FifoExecution.WorkItem.Execute()
at Litium.Application.Common.FifoExecution.ProcessQueuedItems(Object ignored)

Litium version: 8.10.0

I think this is an related error to that the notification webhook from Adyen not is properly configured, see Adyen payment app and notifications - Questions - Litium Forum.

And in this case you should wait with creating the shipment and put into processing until the capture transaction is succeeded in this case.

OK, so I’ve managed to get things to work with the communication with Adyen. I still get this error for Swish payments though.

You say that I “should wait with creating the shipment and put into processing until the capture transaction is succeeded in this case”. How would I best determine if the current payment is one of “this case”?
For other payments I need to create the shipment and push it to processing to get the payment captured. So some steps would happen in reverse order depending on something (not sure what to check to know what case to go with for each payment).

The usual case this will not be a problem when the order is sent to ERP and before ERP process and deliver the order the answer from Adyen is arriving.

Instead of trying to create the shipment on OrderConfirmed event the PaymentCaptured event can be used and will be raised when the answer for the payment arrives.

Yes, I understand that but in our case we’re selling software that will be instantly delivered without involving the ERP.

Problem is that, from your suggestion, we need several flows to handle different kinds of payments. If a customer pays with Swish we should wait until the payment is captured before we create a shipment. But if a customer pays with card we need to create the shipment when the payment is reserved and push the shipment to processing for the payment to be captured. Or have I misunderstood something?

We will also have cases where a customer buys both software and hardware. The hardware delivery will be handled by the ERP so in these cases we need to create two shipments and do a partial delivery of the software first.

Any input on this? What would be the suggested solution for us?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.