Cart Discount Waterfall
Apply cart discounts in the provided order, using half-up basis-point rounding and subtotal thresholds, and show the savings from each promotion.
Custom requests cost 0.04 USDC on Base.
Download example JSON · OpenAPI · Source and usage
Pay with a browser wallet · Open example in checkout
POST a JSON request to /cart-discount-waterfall/v1/check with an x402 V2 client.
Worked example
Request
{
"starting_cents": 1005,
"promotions": [
{
"code": "A",
"type": "percent",
"basis_points": 1000,
"minimum_cents": 1000
},
{
"code": "B",
"type": "fixed",
"cents": 200,
"minimum_cents": 1000
},
{
"code": "C",
"type": "fixed",
"cents": 1000,
"minimum_cents": 0
}
]
}Result
{
"final_cents": 0,
"total_savings_cents": 1005,
"steps": [
{
"code": "A",
"eligible": true,
"savings_cents": 101,
"remaining_cents": 904
},
{
"code": "B",
"eligible": false,
"savings_cents": 0,
"remaining_cents": 904
},
{
"code": "C",
"eligible": true,
"savings_cents": 904,
"remaining_cents": 0
}
]
}Support catalog maintenance through GitHub Sponsors. Sponsor gptenv · Sponsor Jeremy Carter