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 string
A unique key for safely retrying a request without duplicating work.

Path parameters

orderId string
The order ID string that was obtained when the order session was [created](/docs/payment-products/checkout/create-order-session).

Request body

orderLines array
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.
Show child attributes
id string Optional
The unique ID for the order line that is passed along in the [Get order](/docs/order-management/get-order) request response. Providing the id property here ensures that this order line is removed from the uncaptured order lines.
description string
Product name, description etc.
quantity integer
Non negative number.
reference string Optional
SKU or product reference.
totalAmount integer
Total amount in minor units.
totalVatAmount integer
Total VAT amount in minor units.
type string
Type of order line: `physical`, `shippingFee`, `discount`, `giftCard`.
unitDiscountAmount integer Optional
Discount per unit in minor units.
unitPrice integer
Price per unit in minor units.
vat integer
VAT rate in minor units (e.g., 2500 for 25%).
totalCaptureAmount integer
The sum of all order lines `totalAmount`.
{
  "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
A list of captures, what was partially captured will be removed from the `uncaptured` object, and enter the captured list.
Show child attributes
availableActions array
A list of available actions for the order. Each object in the list contains a 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
A date in ISO 8601 format.
ledgerId string
Unique identifier for the sub order.
documentReference string Optional
Unique identifier for the invoice.
documentUrl string Optional
An invoice web link.
note string Optional
An internal note, optionally set when making a refund/partial refund. Defaults to empty string if not set.
orderLines array
An array of order lines.
Show child attributes
description string
Product name, description etc.
quantity integer
Non negative number.
reference string Optional
SKU or product reference.
totalAmount integer
Total amount in minor units.
totalVatAmount integer
Total VAT amount in minor units.
type string
Type of order line: `physical`, `shippingFee`, `discount`, `giftCard`.
unitDiscountAmount integer Optional
Discount per unit in minor units.
unitPrice integer
Price per unit in minor units.
vat integer
VAT rate in minor units (e.g., 2500 for 25%).
status array
A list of possible sub order statuses for merchants that use invoice service. Available values: - `debtCollection` - `fullyPaid` - `partiallyPaid` - `recourse` - `reminder1` - `reminder2` Can also be empty.
totalOrderAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, including VAT.
totalOrderAmountExclVat integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, excluding VAT.
totalOrderVatAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, only the VAT part of the total order amount.
capturedAmount object
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, in case of a partial capture the amount that was captured so far.
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
A list of strings indicating the current status of the order (can be both captured and refunded, for instance).
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
A list of what is still uncaptured after the partial capture.
Show child attributes
availableActions array
A list of available actions for the order. Each object in the list contains a 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
A date in ISO 8601 format.
ledgerId string
Unique identifier for the sub order.
documentReference string Optional
Unique identifier for the invoice.
documentUrl string Optional
An invoice web link.
note string Optional
An internal note, optionally set when making a refund/partial refund. Defaults to empty string if not set.
orderLines array
An array of order lines.
Show child attributes
description string
Product name, description etc.
quantity integer
Non negative number.
reference string Optional
SKU or product reference.
totalAmount integer
Total amount in minor units.
totalVatAmount integer
Total VAT amount in minor units.
type string
Type of order line: `physical`, `shippingFee`, `discount`, `giftCard`.
unitDiscountAmount integer Optional
Discount per unit in minor units.
unitPrice integer
Price per unit in minor units.
vat integer
VAT rate in minor units (e.g., 2500 for 25%).
status array
A list of possible sub order statuses for merchants that use invoice service. Available values: - `debtCollection` - `fullyPaid` - `partiallyPaid` - `recourse` - `reminder1` - `reminder2` Can also be empty.
totalOrderAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, including VAT.
totalOrderAmountExclVat integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, excluding VAT.
totalOrderVatAmount integer
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, only the VAT part of the total order amount.
uncapturedAmount null
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, in case of a partial capture a part of the amount will have been deducted, which will be reflected in `capturedAmount`.
updatedAt string
The timestamp of the latest added event under `events`.