Commerce
Multi-buy 'N for $X' deal API
Evaluates an 'N for $X' multi-buy offer against a desired quantity, splitting into full deal groups plus a regular-price remainder and reporting the effective unit price and savings. Answers 'How much for 7 at 3-for-$10?', 'Is the multi-buy deal worth it?'.
Price$0.02per request
MethodPOST
Route/v1/commerce/multi-buy-deal
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
commercepricingmulti-buydealn-forpromotiondiscountretail
API URL
Integration docshttps://x402.hexl.dev/v1/commerce/multi-buy-dealExample request
{
"regularPrice": 4,
"dealQty": 3,
"dealPrice": 10,
"wantQty": 7
}Example response
{
"regularPrice": 4,
"deal": "3 for $10",
"dealUnitPrice": 3.3333,
"wantQty": 7,
"dealGroups": 2,
"remainderAtRegular": 1,
"dealCost": 20,
"remainderCost": 4,
"total": 24,
"regularTotal": 28,
"totalSaved": 4,
"effectiveUnitPrice": 3.4286,
"dealWorthwhile": true,
"interpretation": "2×(3 for $10) + 1 @ $4 = $24 (effective $3.4286/unit; saved $4)."
}Input schema
{
"type": "object",
"required": [
"regularPrice",
"dealQty",
"dealPrice",
"wantQty"
],
"properties": {
"regularPrice": {
"type": "number",
"examples": [
4
]
},
"dealQty": {
"type": "integer",
"examples": [
3
]
},
"dealPrice": {
"type": "number",
"examples": [
10
]
},
"wantQty": {
"type": "integer",
"examples": [
7
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}