Edit order

Only uncaptured order lines can be edited. Increasing the total order amount may trigger a new credit check.

To check whether the edit action is available, inspect availableActions on the sub-order chunk 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": "Coffee Machine X200",
      "quantity": 9,
      "reference": "111-222-333",
      "totalAmount": 450000,
      "totalVatAmount": 90000,
      "type": "physical",
      "unitDiscountAmount": 0,
      "unitPrice": 50000,
      "vat": 2500
    },
    {
      "description": "Shipping fee",
      "quantity": 1,
      "reference": "444-555-666",
      "totalAmount": 10000,
      "totalVatAmount": 2000,
      "type": "shippingFee",
      "unitDiscountAmount": 0,
      "unitPrice": 10000,
      "vat": 2500
    }
  ],
  "totalOrderAmount": 510000,
  "totalOrderAmountExclVat": 408000,
  "totalOrderVatAmount": 102000
}'
https://api.sandbox.ledyer.com/v1/orders/:orderId

Request Headers

Idempotency-Key string
A unique key for safely retrying a request without duplicating work.

Path parameters

orderId string
The order ID 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%).
totalOrderAmount integer
Total order amount in minor units.
totalOrderAmountExclVat integer
Total order amount excluding VAT, in minor units.
totalOrderVatAmount integer
Total VAT amount in minor units.
{
	"captured": [],
	"capturedAmount": {
		"amount": "0.00",
		"currency": "SEK",
		"formatted": "0.00",
		"formattedWithCurrency": "SEK 0.00",
		"minorUnits": 0
	},
	"createdAt": "2023-02-10T21:28:17.425663Z",
	"customer": {
		"billingAddress": {
			"careOf": "",
			"city": "Stockholm",
			"companyName": "Ledyer AB",
			"country": "SE",
			"postalCode": "11359",
			"streetAddress": "Sveavägen 49",
			"attentionName": ""
		},
		"companyId": "559311-3714",
		"companyName": "Ledyer AB",
		"email": "jan.jonsson@business.com",
		"firstName": "Jan",
		"invoiceChannel": {
			"type": "email",
			"details": ""
		},
		"lastName": "Jonsson",
		"paymentMethod": {
			"provider": "ledyer",
			"type": "invoice"
		},
		"phone": "004613371337",
		"reference1": "",
		"reference2": "",
		"shippingAddress": {
			"attentionName": "",
			"careOf": "",
			"city": "Stockholm",
			"country": "SE",
			"companyName": "Ledyer AB",
			"postalCode": "11359",
			"streetAddress": "Sveavägen 49"
		}
	},
	"events": [
		{
			"amount": {
				"amount": "-500.00",
				"currency": "SEK",
				"formatted": "-500.00",
				"formattedWithCurrency": "-SEK 500.00",
				"minorUnits": -50000
			},
			"createdAt": "2023-02-10T21:28:21.992588Z",
			"id": "oe_24w4qABgHvVTEtuebc5MIvqnplx",
			"ledgerId": "in_24w4pVQQYYEMRKJy4VhBmiay4qw",
			"orderId": "or_24w4p5pJogDfyMevIEddZLqyXMG",
			"type": "edit"
		},
		{
			"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": "5100.00",
				"currency": "SEK",
				"formatted": "5,100.00",
				"formattedWithCurrency": "SEK 5,100.00",
				"minorUnits": 510000
			},
			"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",
	"orderAmount": {
		"amount": "4600.00",
		"currency": "SEK",
		"formatted": "4,600.00",
		"formattedWithCurrency": "SEK 4,600.00",
		"minorUnits": 460000
	},
	"orderReference": "DXXX5HYZ",
	"paymentMethod": {
		"provider": "ledyer",
		"type": "invoice"
	},
	"refunded": [],
	"refundedAmount": {
		"amount": "0.00",
		"currency": "SEK",
		"formatted": "0.00",
		"formattedWithCurrency": "SEK 0.00",
		"minorUnits": 0
	},
	"riskProfile": {
		"tags": []
	},
	"status": ["uncaptured"],
	"storeId": "970245072",
	"uncaptured": {
		"availableActions": [
			{
				"type": "cancel"
			},
			{
				"type": "capture"
			},
			{
				"type": "partialCapture"
			},
			{
				"type": "editCustomer"
			},
			{
				"type": "editOrder"
			},
			{
				"type": "extendOrderExpiry"
			}
		],
		"createdAt": "2023-02-10T21:28:17.425663541Z",
		"ledgerId": "in_24w4pVQQYYEMRKJy4VhBmiay4qw",
		"note": "",
		"orderLines": [
			{
				"description": "Coffee Machine X200",
				"id": "ol_274BCHVWsZhUyROkVCzMJf7iz5V",
				"quantity": 9,
				"reference": "111-222-333",
				"totalAmount": 450000,
				"totalVatAmount": 90000,
				"type": "physical",
				"unitPrice": 50000,
				"vat": 2500
			},
			{
				"description": "Shipping fee",
				"id": "ol_274BCKxRHZHzzRPADiBH9txmmO2",
				"quantity": 1,
				"reference": "444-555-666",
				"totalAmount": 10000,
				"totalVatAmount": 2000,
				"type": "shippingFee",
				"unitPrice": 10000,
				"vat": 2500
			}
		],
		"status": [],
		"totalOrderAmount": {
			"amount": "4600.00",
			"currency": "SEK",
			"formatted": "4,600.00",
			"formattedWithCurrency": "SEK 4,600.00",
			"minorUnits": 460000
		},
		"totalOrderAmountExclVat": {
			"amount": "3680.00",
			"currency": "SEK",
			"formatted": "3,680.00",
			"formattedWithCurrency": "SEK 3,680.00",
			"minorUnits": 368000
		},
		"totalOrderVatAmount": {
			"amount": "920.00",
			"currency": "SEK",
			"formatted": "920.00",
			"formattedWithCurrency": "SEK 920.00",
			"minorUnits": 92000
		}
	},
	"uncapturedAmount": {
		"amount": "4600.00",
		"currency": "SEK",
		"formatted": "4,600.00",
		"formattedWithCurrency": "SEK 4,600.00",
		"minorUnits": 460000
	},
	"updatedAt": "2023-02-10T21: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.
  • 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 an edit, the amount is updated.
uncaptured object
Information about order lines that are still uncaptured. After an edit, these values are updated.
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 object
An object containing strings `amount`, `currency`, `formatted`, `formattedWithCurrency`, and integer `minorUnits`. After an edit, the amount is updated.
updatedAt string
The timestamp of the latest event in `events`.