Capture order (full)
This request will capture all the remaining uncaptured
order lines of the order.
The order lines included in the request body must match the order lines that are remaining in the uncaptured state.
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.
- Example Request
- Example 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": "APPLE iPhone 13 Pro 5G 256GB - 6.1\" Smartphone - Guld",
"quantity": 3,
"reference": "1336371",
"totalAmount": 4077000,
"totalVatAmount": 815400,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 1359000,
"vat": 2500
},
{
"description": "Shipping fee",
"quantity": 1,
"reference": "444-555-666",
"totalAmount": 10000,
"totalVatAmount": 2000,
"type": "shippingFee",
"unitDiscountAmount": 0,
"unitPrice": 10000,
"vat": 2500
}
],
"totalCaptureAmount": 4087000
}'
https://api.sandbox.ledyer.com/v1/orders/:orderId/capture
Request Headers
Idempotency-Key
stringOptionalBy 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 orderlinesAn array of order lines.
totalCaptureAmount
integerThe sum of all order lines totalAmount
.
{
"authorizeStatus": "authorized",
"captured": [
{
"availableActions": [
{
"type": "refund"
},
{
"type": "partialRefund"
}
],
"createdAt": "2023-02-12T21:07:34.996030644Z",
"documentReference": "970245072092446903",
"documentUrl": "https://invoice.sandbox.ledyer.com/invoice-970245072",
"ledgerId": "in_251gXaJlexehngiZ7oUW3aTe7SK",
"note": "",
"orderLines": [
{
"description": "APPLE iPhone 13 Pro 5G 256GB - 6.1\" Smartphone - Guld",
"id": "ol_251gXZSICCSqIj2uTwfnRy5xLE4",
"quantity": 3,
"reference": "1336371",
"totalAmount": 4077000,
"totalVatAmount": 815400,
"type": "physical",
"unitDiscountAmount": 0,
"unitPrice": 1359000,
"vat": 2500
},
{
"description": "Shipping fee",
"id": "ol_251gXYKdDEMdjR6pCsvBi0G1LSg",
"quantity": 1,
"reference": "444-555-666",
"totalAmount": 10000,
"totalVatAmount": 2000,
"type": "shippingFee",
"unitDiscountAmount": 0,
"unitPrice": 10000,
"vat": 2500
}
],
"status": [],
"totalOrderAmount": {
"amount": "40870.00",
"currency": "SEK",
"formatted": "40,870.00",
"formattedWithCurrency": "SEK 40,870.00",
"minorUnits": 4087000
},
"totalOrderAmountExclVat": {
"amount": "32696.00",
"currency": "SEK",
"formatted": "32,696.00",
"formattedWithCurrency": "SEK 32,696.00",
"minorUnits": 3269600
},
"totalOrderVatAmount": {
"amount": "8174.00",
"currency": "SEK",
"formatted": "8,174.00",
"formattedWithCurrency": "SEK 8,174.00",
"minorUnits": 817400
}
}
],
"capturedAmount": {
"amount": "40870.00",
"currency": "SEK",
"formatted": "40,870.00",
"formattedWithCurrency": "SEK 40,870.00",
"minorUnits": 4087000
},
"createdAt": "2023-02-12T21:07:26.573758Z",
"customer": { ... },
"events": [
{
"amount": {
"amount": "40870.00",
"currency": "SEK",
"formatted": "40,870.00",
"formattedWithCurrency": "SEK 40,870.00",
"minorUnits": 4087000
},
"createdAt": "2023-02-13T21:07:34.99603Z",
"id": "oe_251gYeeCAuO19mDfigbyET5v0X5",
"ledgerId": "in_251gXaJlexehngiZ7oUW3aTe7SK",
"orderId": "or_251gX4vC526p3HER0rX9N0DhWPd",
"type": "fullCapture"
},
{
"amount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"createdAt": "2023-02-12T21:07:27.573758Z",
"id": "oe_251gXZgnGlRIa6H3GOyJcWjUyFN",
"ledgerId": "in_251gXaJlexehngiZ7oUW3aTe7SK",
"orderId": "or_251gX4vC526p3HER0rX9N0DhWPd",
"type": "readyForCapture"
},
{
"amount": {
"amount": "40870.00",
"currency": "SEK",
"formatted": "40,870.00",
"formattedWithCurrency": "SEK 40,870.00",
"minorUnits": 4087000
},
"createdAt": "2023-02-12T21:07:26.573758Z",
"id": "oe_251gXZgnGlRIa6H3GOyJcWjUyFN",
"ledgerId": "in_251gXaJlexehngiZ7oUW3aTe7SK",
"orderId": "or_251gX4vC526p3HER0rX9N0DhWPd",
"type": "create"
}
],
"expiresAt": "2023-02-26T21:07:26.573758Z",
"id": "or_251gX4vC526p3HER0rX9N0DhWPd",
"merchantId": "ac_1xWqkkS5aIbxCJsoseRhSd0OJyD",
"merchantReference": "or_251gX4vC526p3HER0rX9N0DhWPd",
"orderAmount": {
"amount": "40870.00",
"currency": "SEK",
"formatted": "40,870.00",
"formattedWithCurrency": "SEK 40,870.00",
"minorUnits": 4087000
},
"orderReference": "MHC8LGM1",
"paymentMethod": {
"provider": "ledyer",
"type": "advanceInvoice"
},
"refunded": [],
"refundedAmount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"riskProfile": {
"tags": []
},
"status": [
"fullyCaptured"
],
"storeId": "970245072",
"uncaptured": null,
"uncapturedAmount": {
"amount": "0.00",
"currency": "SEK",
"formatted": "0.00",
"formattedWithCurrency": "SEK 0.00",
"minorUnits": 0
},
"updatedAt": "2023-02-13T21:07:34.99603Z"
}
captured
array of suborderA list of captures.
capturedAmount
objectAn object containing strings amount
, currency
, formatted
, formattedWithCurrency
and integer minorUnits
, in case of a full capture the amount will be what was previously uncaptured.
events
array of eventsA list of event objects, or snapshots on the order.
Each object contains an amount
object with the strings amount
, currency
formatted
, formattedWithCurrency
and integer minorUnits
pertaining to the event.
The event object also contains the date string createdAt
as well as orderId
and ledgerId
, and finally the event type
.
Events can have one of the following types:
acknowledge
: Order has been acknowledged.authorize
: Order has been authorized.cancel
: Order has been cancelled.create
: Order has been created.edit
: The order lines etc have been edited since first authorized.editCustomer
: The customer details of the order have been edited.editPaymentMethod
: The payment method of the order has been changed.extendExpiry
: The expiry date of the order 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 of the order lines have been captured.partialRefund
: Some of the order lines have been added to a credit invoice.readyForCapture
: Order has been made ready for capture.setReference
: The merchant's order reference has been updated.
status
array of stringsA list of strings indicating the current status of the order (can be both captured and refunded, for instance).
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
nullIn case of a full capture request the uncaptured
object will come back empty as null
.
uncapturedAmount
objectAn object containing strings amount
, currency
, formatted
, formattedWithCurrency
and integer minorUnits
, in case of a full capture the amount will be 0.
updatedAt
stringThe timestamp of the latest added event under events
.