Distribute a discount-token budget across a basket (internal)

Computes the fair distribution of a discount-token budget across a
basket. Each product offers discount levels, each with a stock capacity;
the service assigns units to levels so total token spend stays within the
allowed band while spreading discounts fairly rather than concentrating
them on the highest level. Pure compute — no side effects. Called by the
checkout service over SigV4 (AWS_IAM), the convention for /internal/*
routes whose caller is one of our own services.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

A basket and a discount-token budget to distribute across it.

Beyond the per-field limits below, the basket as a whole must satisfy Σ (highest level × quantity) ≤ 20000, which bounds the solver's working set. It cannot be expressed in JSON Schema, so a basket within every individual limit can still be rejected with discount-calculator-basket-too-large. Real baskets sit orders of magnitude below it.

integer
required
0 to 1000000

Total discount-token budget to distribute.

integer
0 to 1000000
Defaults to 0

Tokens the total assignment may exceed the budget by.

integer
0 to 1000000
Defaults to 0

Tokens the total assignment may fall short of the budget by.

products
array of objects
required
length ≤ 200
products*
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/problem+json