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.

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 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.
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%).
totalCaptureAmount integer
The sum of all order lines `totalAmount`.
{
  "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
A list of captures.
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 full capture the amount will be what was previously uncaptured.
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 null
In case of a full capture request the `uncaptured` object will come back empty as `null`.
uncapturedAmount object
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency` and integer `minorUnits`, in case of a full capture the amount will be 0.
updatedAt string
The timestamp of the latest added event under `events`.