Cancel sub order

This request removes a sub-order (order chunk). To check whether this action is available, inspect availableActions on the sub-order chunk from the GET order response.

curl -X DELETE 
  -H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' 
  https://api.sandbox.ledyer.com/v1/orders/:orderId/:ledgerId

Path parameters

orderId string
The order ID obtained when the order session was [created](/docs/payment-products/checkout/create-order-session).
ledgerId string
The ledger ID of the sub-order (order chunk). You can find it on each chunk (`captured`, `refunded`, `uncaptured`).
{
  "captured": [],
  "capturedAmount": {
    "amount": "0.00",
    "currency": "SEK",
    "formatted": "0.00",
    "formattedWithCurrency": "SEK 0.00",
    "minorUnits": 0
  },
  "customer":  { ... },
  "createdAt": "2023-02-10T21:28:17.425663Z",
  "events": [
    {
      "amount": {
        "amount": "5000.00",
        "currency": "SEK",
        "formatted": "5,000.00",
        "formattedWithCurrency": "SEK 5,000.00",
        "minorUnits": 500000
      },
      "createdAt": "2023-02-11T21:28:21.992588Z",
      "id": "oe_24y39ukP6XnNLSWKBIcpICNlN7M",
      "ledgerId": "in_24w4pVQQYYEMRKJy4VhBmiay4qw",
      "orderId": "or_24w4p5pJogDfyMevIEddZLqyXMG",
      "type": "cancel"
    },
    {
      "amount": {
        "amount": "0.00",
        "currency": "SEK",
        "formatted": "0.00",
        "formattedWithCurrency": "SEK 0.00",
        "minorUnits": 0
      },
      "createdAt": "2023-02-10T21:28:18.425663Z",
      "id": "oe_24w4pSYb70kRiEu7FnlQ0ck3iV8",
      "ledgerId": "in_24w4pVQQYYEMRKJy4VhBmiay4qw",
      "orderId": "or_24w4p5pJogDfyMevIEddZLqyXMG",
      "type": "readyForCapture"
    },
    {
      "amount": {
        "amount": "5000.00",
        "currency": "SEK",
        "formatted": "5,000.00",
        "formattedWithCurrency": "SEK 5,000.00",
        "minorUnits": 500000
      },
      "createdAt": "2023-02-10T21:28:17.425663Z",
      "id": "oe_24w4pSYb70kRiEu7FnlQ0ck3iV8",
      "ledgerId": "in_24w4pVQQYYEMRKJy4VhBmiay4qw",
      "orderId": "or_24w4p5pJogDfyMevIEddZLqyXMG",
      "type": "create"
    }
  ],
  "expiresAt": "2023-02-24T21:28:17.425663Z",
  "id":  "or_24w4p5pJogDfyMevIEddZLqyXMG",
  "merchantId":  "ac_1xWqkkS5aIbxCJsoseRhSd0OJyD",
  "merchantReference":  "or_24w4p5pJogDfyMevIEddZLqyXMG",
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "orderAmount": {
    "amount": "0.00",
    "currency": "SEK",
    "formatted": "0.00",
    "formattedWithCurrency": "SEK 0.00",
    "minorUnits": 0
  },
  "orderReference":  "DXXX5HYZ",
  "refunded": [],
  "refundedAmount": {
    "amount": "0.00",
    "currency": "SEK",
    "formatted": "0.00",
    "formattedWithCurrency": "SEK 0.00",
    "minorUnits": 0
  },
  "riskProfile": {
    "tags": []
  },
  "status": [
    "cancelled"
  ],
  "storeId":  "970245072",
  "uncaptured": null,
  "uncapturedAmount": {
    "amount": "0.00",
    "currency": "SEK",
    "formatted": "0.00",
    "formattedWithCurrency": "SEK 0.00",
    "minorUnits": 0
  },
  "updatedAt": "2023-02-11T21:28:21.992588Z"
}
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.
  • invoiceRecourse: The customer paid the invoice directly to the merchant.
  • 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.
orderAmount object
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency`, and integer `minorUnits`. After cancellation, the amount is 0.
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 a cancel response, `uncaptured` is returned as `null`.
uncapturedAmount object
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency`, and integer `minorUnits`. After cancellation, the amount is 0.
updatedAt string
The timestamp of the latest event in `events`.