Commerce
Split bill w/ tax & tip API
Splits a bill among diners by their item shares, allocating tax and tip proportionally (the fair method) and fixing penny rounding on the last person. Answers 'How do we split the check fairly with tax and tip?', 'What does each person owe?'.
Price$0.02per request
MethodPOST
Route/v1/commerce/split-bill
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
commercesplit-billtiptaxrestaurantallocationproportionalcheckout
API URL
Integration docshttps://x402.hexl.dev/v1/commerce/split-billExample request
{
"shares": [
{
"name": "A",
"amount": 30
},
{
"name": "B",
"amount": 20
}
],
"taxRatePct": 10,
"tipPct": 20
}Example response
{
"preTaxTotal": 50,
"taxRatePct": 10,
"tax": 5,
"tipPct": 20,
"tipOnPreTax": false,
"tip": 11,
"grandTotal": 66,
"perPerson": [
{
"name": "A",
"preTax": 30,
"share": 0.6,
"taxPortion": 3,
"tipPortion": 6.6,
"totalOwed": 39.6
},
{
"name": "B",
"preTax": 20,
"share": 0.4,
"taxPortion": 2,
"tipPortion": 4.4,
"totalOwed": 26.4
}
],
"interpretation": "$50 + tax $5 + tip $11 = $66, split proportionally across 2."
}Input schema
{
"type": "object",
"required": [
"shares"
],
"properties": {
"shares": {
"type": "array",
"examples": [
[
{
"name": "A",
"amount": 30
},
{
"name": "B",
"amount": 20
}
]
]
},
"taxRatePct": {
"type": "number",
"examples": [
10
]
},
"tipPct": {
"type": "number",
"examples": [
20
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}