Update Sales Order Discount
PUT/api/sales-orders/:salesOrder/discounts/:discount
Updates an existing discount on a sales order and recalculates the order's discount totals.
orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Request body fields (all optional — omitted fields keep their current values):
- scope (string):
lineororder. - type (string):
percentageorfixed_amount. - rate (number): Percentage rate, 0-100.
- amount (number): Discount amount in the order currency, minimum 0.
- name (string, max 255): Display label.
- sales_order_line_id (integer): Existing product line the discount applies to.
- financial_line_id (integer): Existing charge line the discount applies to.
- source_type (string, max 50): Origin of the discount.
- source_reference (string, max 255): External reference such as a coupon code.
- apply_before_tax (boolean): Whether the discount applies before tax is calculated.
- sequence (integer, min 0): Application order.
Behavior:
- The update triggers the same full discount recalculation as creating a discount — line totals, order-level allocation across lines, and the order's discount totals are refreshed.
- For percentage discounts the effective
amountis recomputed and returned in the response.
The response is the updated discount object (no envelope).
Path parameters:
- salesOrder (required): Sales order ID.
- discount (required): Discount ID.
Requires permission: sales_orders.update
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.