{"uid":"cap_Pm6W0yrFNSfdc4JlCDdU-","slug":"writerslogic-cash-rounding-1d546fdc","name":"WritersLogic Cash Rounding","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/cash-rounding?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","pattern":"^-?\\d{1,15}(\\.\\d{1,12})?$","maxLength":30,"description":"Decimal string such as \"-12.50\" (up to 15 integer and 12 fraction digits). JSON numbers are not accepted: they are binary floats."},"tender":{"enum":["cash","electronic"],"type":"string","description":"Default cash."},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"ISO 4217 alphabetic code, upper case."},"rounding":{"enum":["half-up","half-down","half-even","up","down","ceiling","floor"],"type":"string","description":"Tie mode only: an exact tie between two payable amounts under a caller increment or a built-in rule that states no tie rule. Any other amount rounds to the nearest payable amount, and a tie rule the cited source states (SEK) wins. half-up: ties away from zero. half-down: ties toward zero. half-even: ties to the even neighbour. up: away from zero. down: toward zero. ceiling: toward +infinity. floor: toward -infinity."},"increment":{"type":"string","pattern":"^-?\\d{1,15}(\\.\\d{1,12})?$","maxLength":30,"description":"Caller rule: smallest payable amount in major units, e.g. \"0.05\". Overrides the built-in rule."}},"additionalProperties":false},"maxItems":100,"minItems":1}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_8UeQ4VzvUqirY37OuLt1N","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Rounds up to 100 final cash totals to the smallest legally payable increment for a given currency, returning the rounded amount or change owed","exampleAgentPrompt":"The customer's total is 47.83 CHF — what should they actually pay in cash, rounded to the smallest legal Swiss franc increment?","exampleUseCases":[{"title":"Swiss franc cash payment rounding","prompt":"A customer's basket comes to CHF 23.47. What do they actually hand over in cash, given Switzerland's 5-centime rounding rule?"},{"title":"Canadian dollar change calculation","prompt":"My POS shows a CAD total of $18.63. The customer pays with a $20 bill — how much change do I give them, rounded to the nearest Canadian nickel?"},{"title":"Custom-increment cash rounding for unsupported currency","prompt":"I need to round a cash total of 1,284.32 MXN to the nearest 0.50 peso — what's the rounded amount the customer should pay?"}],"resultDescription":"For each submitted item, the endpoint returns the rounded payable amount for cash transactions (or the unrounded pass-through for electronic/card), the increment used, the rounding rule applied, and — if the amount falls on an exact tie that the authoritative source does not resolve — an 'unknown' status along with both candidate amounts.","failureModes":["Currency not in built-in rules and no caller increment provided — returns an error requiring an explicit increment","Amount string uses invalid format (e.g. JSON number instead of decimal string) — rejected with schema validation error","More than 100 items submitted — request rejected","Increment value of zero or negative submitted — rejected","Unknown currency code (non-ISO 4217) — error response"],"whenToPreferThis":"Use this endpoint when you need legally defensible cash rounding for CHF, CAD, SEK, or AUD (using official government sources), or when you need to apply a custom cash-rounding increment for any other currency. Prefer it over generic rounding libraries because it encodes authoritative national rules, distinguishes cash vs electronic tender, handles tie-breaking modes, and processes up to 100 totals in a single call. Do not use it for rounding individual line items, tax calculations, or invoice generation.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T12:36:37.302Z","isFirstParty":false,"canonicalSlug":"writerslogic-cash-rounding-1d546fdc"}