Skip to main content

Exchange Sales Order

POST 

/api/sales-orders/:salesOrder/exchange

Creates an exchange order for an existing order (e.g. swapping returned items), linked to the original order or to a sales credit, and returns the new order's full detail.

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

The new order is a copy of the original with:

  • order number {original}-E-{YYYYMMDD} and order date set to now
  • only the requested lines, at the requested quantities, keeping the original line prices
  • a sales-credit payment automatically recorded for the new order's total (the exchange is paid by credit), and the order is approved immediately
  • an exchange link to the sales credit when sales_credit_id is provided, otherwise to the original order

Authentication: Requires Bearer token.

Request body fields:

  • sales_order_lines (array, optional): Lines to exchange. Each item: id (integer, required — must be a line of this order), quantity (number, required).
  • sales_credit_id (integer, optional): Existing sales credit to link the exchange order to.

Path parameters:

  • salesOrder (required): Sales order ID to exchange from.

Requires permission: sales_orders.update

Request

Responses

OK

Response Headers
    Content-Type