Cancel sub order
This request will remove a sub-order (order chunk).
Whether the cancel action on a sub-order is available on the sub-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 DELETE \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
https://api.sandbox.ledyer.com/v1/orders/:orderId/:ledgerId \
Path parameters
orderId
The order ID string that was obtained when the order session was created.
ledgerId
The ledgerId of the sub order (order chunk). LedgerId can be found on each chunk (captured, refunded, uncaptured).
{
"authorizeStatus": "authorized",
"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 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.
orderAmount
objectAn object containing strings amount
, currency
, formatted
, formattedWithCurrency
and integer minorUnits
.
After an order has been cancelled the amount will be 0.
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 the response from a cancel request the uncaptured
object will come back empty as null
.
uncapturedAmount
objectAn object containing strings amount
, currency
, formatted
, formattedWithCurrency
and integer minorUnits
.
After an order has been cancelled the amount will be 0.
updatedAt
stringThe timestamp of the latest added event under events
.