Idempotency-Key string 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
Path parameters
orderId string Request body
orderLines array Show child attributes
id string Optional description string quantity integer reference string Optional totalAmount integer totalVatAmount integer type string unitDiscountAmount integer Optional unitPrice integer vat integer totalCaptureAmount integer {
"captured": [
{
"availableActions": [
{
"type": "refund"
},
{
"type": "partialRefund"
}
],
"createdAt": "2023-04-09T14:45:35.367198726Z",
"documentReference": "088800149117282055",
"documentUrl": "https://invoice.dev.ledyer.com/invoice-088800149-in_2OC54xBO5LV1RVitiv0Ptd3Q1Ph.pdf?Expires=1681055137&Signature=PmCZi-rMdqlPnPCGre6TFR69DvXkjKffZ7PV0aer0UGbUwbwOSPFUwdJ74CY8uK~yF1GPM~r8321X1cinG-nC0BOm5St9dOmhi63RkQtC2yO2Uo-exvAqpE~uC-s60yN7Y7E0jUtEKzyihsOu-HwflLMUem~mlg6~Z5IzBAjxFoJth0VYkWFfyY-vZqN-RPOS3ZST1Oh4yEydYwQGp0eXNFI5qPeQyNzXPzbhKweM1~Sio1VW8r2vb8I9yippikI7NbCrRMUUoBuMrx7wtUuoRLIUHAnSwqj8uPyY4X4zM793HS55etTsJNfcZDMb15ffMxGJcZHZ4vtPZvKs508Vg__&Key-Pair-Id=K1HDCXLOUP2TQK",
"ledgerId": "in_2OC54xBO5LV1RVitiv0Ptd3Q1Ph",
"note": "",
"orderLines": [
{
"description": "SAMSUNG Galaxy S20 FE 4G 128GB (6GB RAM) 6.5 Smartphone - Cl",
"id": "ol_2OC52yClydPxsvKPtujAyQmgRrE",
"reference": "1334227",
"quantity": 1,
"totalAmount": 489000,
"totalVatAmount": 97800,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 489000,
"vat": 2500
}
],
"status": [],
"totalOrderAmount": {
"amount": "4890.00",
"currency": "SEK",
"formatted": "4,890.00",
"formattedWithCurrency": "SEK 4,890.00",
"minorUnits": 489000
},
"totalOrderAmountExclVat": {
"amount": "3912.00",
"currency": "SEK",
"formatted": "3,912.00",
"formattedWithCurrency": "SEK 3,912.00",
"minorUnits": 391200
},
"totalOrderVatAmount": {
"amount": "978.00",
"currency": "SEK",
"formatted": "978.00",
"formattedWithCurrency": "SEK 978.00",
"minorUnits": 97800
}
}
],
"capturedAmount": {
"amount": "4890.00",
"currency": "SEK",
"formatted": "4,890.00",
"formattedWithCurrency": "SEK 4,890.00",
"minorUnits": 489000
},
"createdAt": "2023-04-09T14:45:19.146027Z",
"customer": { ... },
"events": [
{
"amount": {
"amount": "4890.00",
"currency": "SEK",
"formatted": "4,890.00",
"formattedWithCurrency": "SEK 4,890.00",
"minorUnits": 489000
},
"createdAt": "2023-04-09T14:45:35.367198Z",
"id": "oe_2OC54z91XRnRk5v9Ve1yJL2brtI",
"ledgerId": "in_2OC54xBO5LV1RVitiv0Ptd3Q1Ph",
"orderId": "or_2OC51O5BycRRDboM4PPjYSz0vm5",
"type": "partialCapture"
},
{
"amount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"createdAt": "2023-04-09T14:45:19.146027Z",
"id": "oe_2OC537IyOtvn8kCbuN3z3k1ZeOY",
"ledgerId": "in_2OC52zeSKfMJWxz8eKFRlibWiPQ",
"orderId": "or_2OC51O5BycRRDboM4PPjYSz0vm5",
"type": "readyForCapture"
},
{
"amount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"createdAt": "2023-04-09T14:45:20.754919Z",
"id": "oe_2OC537AKCCYkfmoEQsEbocaaBDQ",
"ledgerId": "in_2OC52zeSKfMJWxz8eKFRlibWiPQ",
"orderId": "or_2OC51O5BycRRDboM4PPjYSz0vm5",
"type": "acknowledge"
},
{
"amount": {
"amount": "14880.00",
"currency": "SEK",
"formatted": "14,880.00",
"formattedWithCurrency": "SEK 14,880.00",
"minorUnits": 1488000
},
"createdAt": "2023-04-09T14:45:19.146027Z",
"id": "oe_2OC530BaBoxsWXXdgcBsfqYsdUj",
"ledgerId": "in_2OC52zeSKfMJWxz8eKFRlibWiPQ",
"orderId": "or_2OC51O5BycRRDboM4PPjYSz0vm5",
"type": "create"
}
],
"expiresAt": "2023-04-23T14:45:19.146027Z",
"id": "or_2OC51O5BycRRDboM4PPjYSz0vm5",
"merchantId": "ac_1xWqkkS5aIbxCJsoseRhSd0OJyD",
"merchantReference": "or_24y1E89OBs0KjAmRXEJu5pivxt4",
"orderAmount": {
"amount": "14880.00",
"currency": "SEK",
"formatted": "14,880.00",
"formattedWithCurrency": "SEK 14,880.00",
"minorUnits": 1488000
},
"orderReference": "UB1CECSM",
"paymentMethod": {
"provider": "ledyer",
"type": "invoice"
},
"riskProfile": {
"tags": []
},
"refunded": [],
"refundedAmount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"status": [
"partiallyCaptured"
],
"storeId": "970245072",
"uncaptured": {
"availableActions": [
{
"type": "cancel"
},
{
"type": "capture"
},
{
"type": "partialCapture"
},
{
"type": "editCustomer"
},
{
"type": "editOrder"
},
{
"type": "extendOrderExpiry"
}
],
"createdAt": "2023-04-09T14:45:19.146027112Z",
"ledgerId": "in_2OC52zeSKfMJWxz8eKFRlibWiPQ",
"note": "",
"orderLines": [
{
"description": "APPLE iPhone 13 Pro 5G 256GB - 6.1" Smartphone - Guld",
"id": "ol_2OC52vhkHDwdLnwKkELFwiP6Io9",
"quantity": 1,
"reference": "231654",
"totalAmount": 999000,
"totalVatAmount": 199800,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 999000,
"vat": 2500
}
],
"status": [],
"totalOrderAmount": {
"amount": "9990.00",
"currency": "SEK",
"formatted": "9,990.00",
"formattedWithCurrency": "SEK 9,990.00",
"minorUnits": 999000
},
"totalOrderAmountExclVat": {
"amount": "7992.00",
"currency": "SEK",
"formatted": "7,992.00",
"formattedWithCurrency": "SEK 7,992.00",
"minorUnits": 799200
},
"totalOrderVatAmount": {
"amount": "1998.00",
"currency": "SEK",
"formatted": "1,998.00",
"formattedWithCurrency": "SEK 1,998.00",
"minorUnits": 199800
}
},
"uncapturedAmount": {
"amount": "9990.00",
"currency": "SEK",
"formatted": "9,990.00",
"formattedWithCurrency": "SEK 9,990.00",
"minorUnits": 999000
},
"updatedAt": "2023-04-09T14:45:35.367198Z",
} captured array Show child attributes
availableActions array type property that describes an available action. The following types can be listed: - cancel: The order can be cancelled. - capture: The order can be fully
captured. - editCustomer: The customer details of the order can be
edited. - editOrder: The order lines can be edited. - editPaymentMethod: The payment method of the order can be edited. - extendExpiry: The
expiry date of the order can be extended. - partialCapture: The order can
be partially captured. - partialRefund: The order can be partially
refunded. - refund: The order can be fully refunded.createdAt string ledgerId string documentReference string Optional documentUrl string Optional note string Optional orderLines array Show child attributes
description string quantity integer reference string Optional totalAmount integer totalVatAmount integer type string unitDiscountAmount integer Optional unitPrice integer vat integer status array totalOrderAmount integer totalOrderAmountExclVat integer totalOrderVatAmount integer capturedAmount object events array A list of order event snapshots. Each event includes an amount object with amount, currency, formatted, formattedWithCurrency, and minorUnits, plus createdAt, orderId, ledgerId, and type.
Supported type values:
acknowledge: Order has been acknowledged.authorize: Order has been authorized.cancel: Order has been cancelled.create: Order has been created.edit: Order lines and related order details have been edited since first authorization.editCustomer: Customer details have been edited.editPaymentMethod: Payment method has been changed.extendExpiry: Order expiry has been extended at least once.fullCapture: All order lines have been captured.fullRefund: All order lines have been added to a credit invoice.paid: Order has been paid.partialCapture: Some order lines have been captured.partialRefund: Some order lines have been added to a credit invoice.readyForCapture: Order has been made ready for capture.setReference: Merchant order reference has been updated.
status array of strings Show child attributes
cancelled: Order has been cancelled.expired: The expiry date of the order is passed.fullyCaptured: All order lines have been captured.fullyPaid: The order has been paid fully.fullyRefunded: All order lines have been added to a credit invoice.partiallyCaptured: Some of the order lines have been captured.partiallyPaid: The order has been paid partially.partiallyRefunded: Some of the order lines have been added to a credit invoice.unacknowledged: The order has not yet been acknowledged.uncaptured: The order has not yet been captured.
uncaptured object Show child attributes
availableActions array type property that describes an available action. The following types can be listed: - cancel: The order can be cancelled. - capture: The order can be fully
captured. - editCustomer: The customer details of the order can be
edited. - editOrder: The order lines can be edited. - editPaymentMethod: The payment method of the order can be edited. - extendExpiry: The
expiry date of the order can be extended. - partialCapture: The order can
be partially captured. - partialRefund: The order can be partially
refunded. - refund: The order can be fully refunded.createdAt string ledgerId string documentReference string Optional documentUrl string Optional note string Optional orderLines array Show child attributes
description string quantity integer reference string Optional totalAmount integer totalVatAmount integer type string unitDiscountAmount integer Optional unitPrice integer vat integer status array totalOrderAmount integer totalOrderAmountExclVat integer totalOrderVatAmount integer uncapturedAmount null updatedAt string