For developers building shops, marketplaces and order systems
Refund the right amount, even when the discount was messy.
Freeze how every discount was split across the lines, then refund any line from that record, not from today’s prices. Send a basket and its discount rules; Valulog does the split and the refund maths.
Free sandbox, no card · paid plans from £15 a month
Basket £50.00Rule: £5.00 off the order
line-1T-shirt ×2£36.00£40.00 shelf · £4.00 of the discount recorded here
line-2Mug ×1£9.00£10.00 shelf · £1.00 of the discount recorded here
Try it: basket and partial refund simulator
No sign-in. Edit the basket and the discount rules, then refund a line. This runs Valulog’s own pricing engine (engine 1.3.0) in your browser: nothing is sent or stored, and the IDs, hash and timestamps are generated for this simulation.
Result: how each discount was split
Refund part of the order
Refunds come from the frozen line, not today’s prices. Refund the same line again to see the over-refund guard; the last unit takes any leftover penny.
POST /v1/calculate · … response
…Copies a ready-to-run curl script for this exact basket and refund, and keeps it on your dashboard. Free sandbox: no card, 1,000 operations a month.
Free sandbox · no card · 1,000 operations a month. Paid plans from £15 a month (Indie). Starter is £49 a month or £490 a year; Growth is £199 a month or £1,990 a year. Prices include any VAT due, for businesses only. Cancel any time.
Valulog is not a payment processor and does not give tax advice. Payments stay with your payment provider; Valulog records how prices, discounts and refunds were calculated.
Example request and response
curl https://api.valulog.com/v1/calculate \
-H "Authorization: Bearer $VALULOG_KEY" \
-H "Idempotency-Key: order-1042" \
-H "Content-Type: application/json" \
-d '{
"currency": "GBP",
"items": [
{ "id": "line-1", "sku": "TEE", "unit_price_cents": 2000, "quantity": 2 },
{ "id": "line-2", "sku": "MUG", "unit_price_cents": 1000, "quantity": 1 }
],
"discounts": [
{ "rule_id": "TENOFF", "type": "PERCENTAGE", "basis_points": 1000 }
]
}'{
"transaction_id": "3b0c6f1e-8d2a-4c47-9f5e-2a7d1c9b4e60",
"currency": "GBP",
"allocations": [
{ "line_item_id": "line-1", "quantity": 2, "original_cents": 4000,
"allocated_discount_cents": 400, "final_cents": 3600 },
{ "line_item_id": "line-2", "quantity": 1, "original_cents": 1000,
"allocated_discount_cents": 100, "final_cents": 900 }
],
"totals": { "subtotal_cents": 5000, "total_discount_cents": 500,
"final_total_cents": 4500, "item_count": 3 },
"snapshot_hash": "sha256:…"
}£5.00 off a £50.00 basket: £4.00 is recorded on the T-shirts and £1.00 on the mug. Refunding one T-shirt later returns £18.00.
How it works
Get a test key
Sign in with your email (no password, no card) and create a vl_test_ key.
Send a basket
POST /v1/calculate with the lines and discount rules. Store the transaction_id.
Refund a line
POST /v1/refunds with the transaction_id, line and quantity. Pay it out through your provider.
Frozen snapshots
Each calculation is stored as an immutable, hashed snapshot of the basket, the rules and how each discount was split across lines.
Refunds from the record
A refund is worked out from the snapshot, never recalculated, so a customer gets back what they actually paid for that line.
Integer money
Every amount is an integer in minor units (pence, cents, yen). No floating point, no rounding drift.
Idempotent writes
Every calculation and refund needs an Idempotency-Key. A retried request returns the original result and never refunds twice.
Over-refund guard
The database refuses refunds beyond what was paid or units beyond what was bought, even under concurrent requests.
Integrity check
Recompute any transaction’s snapshot hash with one call to show the record has not changed since it was written.
Measured, not claimed
Numbers we measured or counted ourselves, with how and when. No logos, no customer quotes, no invented benchmarks.
API response time
331 ms p95, reused connection
p50 310 ms. On a new connection each time (TLS included): p50 415 ms, p95 589 ms.
Method: 200 + 200 sequential requests to GET https://api.valulog.com/v1/health, the public health check, which makes a live round trip to the API’s Postgres database and its Redis store, from a client on UK broadband in England, over the public internet, on 1 December 2026, 00:51–00:58 UK time. 0 failed. These are end-to-end times seen by a client, including network distance to the hosting region. Calculations and refunds were not timed here because they need an API key; they also include a write to the ledger, so do not read the health-check figure as a calculation time.
Automated tests
166 passing tests
102 on the API and pricing engine (13 files, 2 skipped that need a Redis server), 64 on the website and billing (4 files). Counted 1 December 2026.
- Concurrent duplicate requests with one Idempotency-Key write exactly once
- A replayed refund never refunds twice
- Refunds cannot exceed the frozen line, in money or units
- Ledger rows are immutable at the database level
- Penny-splitting: the last unit on a line takes any leftover penny
- Stacked discounts: REMAINING_BALANCE and ORIGINAL_SUBTOTAL give the documented line splits
Vitest. The API tests run against a real, throwaway PostgreSQL 17 database, not mocks. The engine tests check the worked examples published on this site.
Uptime: there is no contractual SLA. See Status for our target and how to monitor the API, and the Stripe partial-refund recipe for a safe integration.
Use cases
- How to refund one line of a discounted orderWhen an order-wide discount is spread across lines, a single-line refund must give back what was paid for that line. Here is how Valulog works it out.
- Refunds on buy-one-get-one-free ordersBuy X get Y offers make returns awkward. Valulog records which unit was free and refunds what was actually paid for each line, from a frozen snapshot.
- Prevent double refunds with idempotency keysRetries, double-clicks and webhook redeliveries can refund twice. Valulog requires an Idempotency-Key on every write and guards each line in the database.
- An audit trail for discounts and refundsKeep a tamper-evident record of how each order total and refund was reached: frozen, hashed snapshots, a refund ledger per line and an integrity check.
- How to split a discount across line itemsShare a percentage or fixed discount across order lines in whole pence, including leftover pennies, and keep that split for later refunds.
- Why money APIs should use integers, not floatsFloating-point types cannot store many decimal amounts exactly. Here is how Valulog keeps every price, discount and refund in integer minor units instead.
- How to stack discounts without confusing the refundWhen two discounts apply to one order, the second can use the original line value or what is left after the first. That choice changes each line’s refund later.
Pricing
Sandbox
Build and test your integration.
£0 free
No card needed.
- Test keys only (vl_test_)
- 1,000 operations a month
- 10 requests a minute
- 1 merchant
Indie
Your first live shop, before volume.
£15 per month
Includes any VAT due. Businesses only.
- Live keys (vl_live_)
- 2,500 operations a month
- 30 requests a minute
- 1 merchant
- Test keys included
- Move up to Starter any time
Starter
One shop in production.
£49 per month
or £490 per year (two months free)
Includes any VAT due. Businesses only.
- Live keys (vl_live_)
- 25,000 operations a month
- 60 requests a minute
- 1 merchant
- Test keys included
Growth
Several brands or storefronts.
£199 per month
or £1,990 per year (two months free)
Includes any VAT due. Businesses only.
- Live keys (vl_live_)
- 250,000 operations a month
- 300 requests a minute
- Up to 10 merchants
- Test keys included
Enterprise · custom price
Marketplaces and platforms above Growth.
- More than 250,000 operations a month
- More than 10 merchants
- Limits and price agreed with you in writing
- Invoice billing can be discussed
An operation is one calculation or one refund. Reads and idempotent replays are free.
- · Prices include any VAT due. Indie is £15 a month. Starter is £49 a month or £490 a year (two months free). Growth is £199 a month or £1,990 a year (two months free).
- · For businesses only: you must be buying for a business, not as a consumer.
- · Cancel any time from your dashboard; your plan runs to the end of the period you have paid for.
- · Full refund of your first payment if you ask within 14 days of it. A refund cancels the subscription and revokes your live keys.
Details: Terms · Refunds and cancellation · Enterprise or larger volumes: contact us.
Questions
Does Valulog take payments or send refunds?
No. Your payment provider (for example Stripe, Adyen or PayPal) still takes the money and sends the refund. Valulog tells you how much to refund for each line and keeps the record of why.
Is Valulog tax or accounting advice?
No. You set the prices and discount rules; Valulog applies them exactly as sent and records the result. Ask your accountant how to treat discounts and refunds for tax.
Can I try it before paying?
Yes. The Sandbox plan is free, needs no card, and gives you test keys (vl_test_) with 1,000 operations a month. Test data never mixes with live data.
What counts as an operation?
One calculation or one refund. Reads, integrity checks, health checks and idempotent replays of a request you already sent are not counted.
What happens if I retry a request?
Every calculation and refund needs an Idempotency-Key header. Sending the same key again returns the original result and never refunds twice.
What if I go over my monthly operations?
Further calculations and refunds get a 429 QUOTA_EXCEEDED response until the 1st of the next month (UTC) or until you move to a larger plan. Nothing is charged automatically for overage.
Who can buy a paid plan?
Businesses only. Paid plans can be billed monthly or annually, include any VAT due, and can be cancelled at any time from the billing portal.
Can I get my money back?
Yes, a full refund of your first payment if you ask within 14 days of it. A refund cancels the subscription and revokes your live keys. See the Refunds page for the details.
Is there an uptime guarantee?
There is no contractual SLA on any plan. Our target is that the API is available whenever your checkout is, and outages are investigated as a priority; that is an aim, not a promise. The Status page publishes a measured record of external GET /v1/health checks, with the method and the date the record started. GET /v1/health reports whether the API, its database and its rate-limit store are reachable right now, so you can monitor it yourself. Write calls are idempotent, so a request that fails during an outage can be retried safely with the same Idempotency-Key. See the Status page and the Stripe partial-refund recipe.
Try it in the sandbox
Test keys, no card. Your test data never mixes with live data.
Get a free test key