Skip to main content

Capture order (partial)

This request will capture the the order lines included in the request body. totalCaptureAmount must be a valid sum of the order lines totalAmount. Sending the id property of an order line is optional, if it is included it will result in the removal of the order line from the uncaptured state. In the scenario where you would like to capture only a quantity subset of an order line, for instance 1 out of 3 existing Samsung phones; you should exclude the id property from that line in the capture request and then make a subsequent request to edit the order and decrease the quantity for the uncaptured order line that was partially captured, as well as recalculating the amounts. Whether the capture action is available on the order or not, can be determined by inspecting the availableActions array on the suborder chunk. This can be retrieved from the GET order response.

curl -X POST \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
-H 'content-type: application/json' \
-H 'Idempotency-Key: da7ca8f9-915b-472b-b5f0-81945bff9e4a' \
-d '{
"orderLines": [
{
"description": "SAMSUNG Galaxy S20 FE 4G 128GB (6GB RAM) 6.5 Smartphone - Cl",
"id": "ol_2OC52yClydPxsvKPtujAyQmgRrE",
"quantity": 1,
"reference": "1334227",
"totalAmount": 489000,
"totalVatAmount": 97800,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 489000,
"vat": 2500
}
],
"totalCaptureAmount": 489000
}'
https://api.sandbox.ledyer.com/v1/orders/:orderId/partialcapture

Request Headers

Idempotency-Key

stringOptional

By providing a unique value for this header, the idempotency of the operation will be guaranteed. This means that retries of requests will be safe to apply in case of network errors, socket errors and timeouts, etc. We recommend using UUID version 4 for the key.

Path parameters

orderId

The order ID string that was obtained when the order session was created.

Request body

orderLines

array of orderlines

An array of order lines. Please note that excluding the id property from an order line in the partial capture request will leave the corresponding uncaptured order line intact after the capture is completed, whilst providing id ensures that the order line is removed from the corresponding uncaptured order line.

totalCaptureAmount

integer

The sum of all order lines totalAmount.