Upcoming changes to discount inheritance [Updated]

Hello Developers!

Currently, no discount is automatically populated when creating orders or orderlines via API. This has to be defined per object/subelement.

We plan to introduce discount inheritance from customers and products to orders and orderlines.

E.g. if customer.discountPercentage has a value set, then any orders you create with this customer object will inherit that value under order.discountPercentage. Any orderlines with products created for this order will receive it’s value under orderLines.discount.

This is in line with how orders & orderlines automatically populate discount when they are created via GUI. You can override this functionality by defining the discount values you want instead.

[Addendum]

We identified that this change could potentionally cause issues for existing integrations. To address this, we have now exposed the discount policy endpoints (v2/discountPolicy) so users can retrieve the correct discounts based on customerId and productId instead.

How to get and use the discount for a specific customer & product:

Call  GET v2/discountPolicy?customerId=<customerId>&productId=<productId>
Parse the JSON response, there is a field called "isPercentage" (boolean);

• If true: The discount is a percentage of the unit price.

Identify "percentage": <discountPercent> from the response,
and set the value on the orderline as: "discount": <discountPercent>. It will automatically deduct the final amount.

• If false: The discount sets the price to a fixed amount.

Find "fixedAmount": <discountedPrice> in the response,
and set it on the order line as "unitPriceExcludingVatCurrency": <discountedPrice>

Published
Categorized as News