# Trigger order payment capture from code (Klarna, Litium 8)

**URL:** <https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782>\
**Category:** Questions\
**Tags:** klarna, litium-8\
**Created:** [December 8, 2022, 10:43pm UTC](https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782 "2022-12-08T22:43:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdxperbol](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/kdxperbol/32/513_2.png) [@kdxperbol](https://forum.litium.com/u/kdxperbol)\
**Post date:** [December 8, 2022, 10:43pm UTC](https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782/1 "2022-12-08T22:43:40Z")

</div>

How do I **trigger payment capture on an order from code** in Litium 8? We are using the Klarna App, and want to trigger payment capture in certain scenarios.

Setting the order state to Processing and then to Completed (after disabling the `HasAllShipmentsShipped` validation) has no effect on the payment.

In Litium 7, it was enough to set the delivery state and order state for capture to occur. We are not using Shipments in our Litium 8 solution.

Litium version: 8.6.1

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [December 9, 2022, 11:17am UTC](https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782/2 "2022-12-09T11:17:10Z")

</div>

The automatic process of trigger the payment is through the shipments. Doing that without shipment is something that is complicated and you need to build all the calculation logic that you need by yourself and nothing that I recommend. Even if you not using shipments I anyway will recommend that you create a shipment and platform will take care of the payment logic.

# Steps for manually executing payment operations.

1. Create an transaction (`Litium.Sales.Transaction`) with all the needed information in sub entities.
2. Execute the transaction with help of the payment transaction manager (`Litium.Sales.PaymentTransactionManager`).

---

<div class="post-metadata">

**Author:** ![kdxperbol](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/kdxperbol/32/513_2.png) [@kdxperbol](https://forum.litium.com/u/kdxperbol)\
**Post date:** [December 9, 2022, 11:34am UTC](https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782/3 "2022-12-09T11:34:40Z")

</div>

Thank you. I don’t think we want to use the Transaction Manager.

What exactly is needed for a full capture to occur using Shipments?

1. Create a Full Shipment for a Sales Order, i.e., a Shipment that contains all products for the sales order
2. Set the Shipment to Shipped (via ReadyToShip and Processing)
3. ?

Does anything have to happen on the Sales Order itself? Order status? Payment status?

**EDIT** : The above steps successfully capture the payment, and move the order to Completed.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [January 6, 2023, 11:34am UTC](https://forum.litium.com/t/trigger-order-payment-capture-from-code-klarna-litium-8/2782/4 "2023-01-06T11:34:52Z")

</div>

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