With a buy-one-get-one-free offer, one unit is paid for and one is free. When something comes back, you need to know which line carried the discount. Valulog records that at the time of sale.
Record which unit was discounted
A BUY_X_GET_Y rule names how many units qualify (buy_quantity), how many get the discount (get_quantity) and how much off they get in basis points (10000 = free). With cheapest_first set, the cheapest eligible units get the discount.
For socks at £8.00 and £6.00 on a buy-one-get-one-free rule, the £6.00 pair is free: its line is recorded as paid £0.00, and the £8.00 line as paid £8.00.
Refund what was paid for the line
Refunding the £8.00 line returns £8.00. A refund of the free line is refused with INSUFFICIENT_REFUNDABLE, because nothing was paid for it.
Whether a customer who returns the paid item may keep the free one is your returns policy. Valulog does not decide it; it gives you the exact paid amount per line so your policy can be applied consistently.
Partial quantities
If a line has several units, refund any number of them with quantity. Valulog tracks units and pence already refunded on each line and refuses anything beyond what was bought or paid.
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.
Run this exact payload in Sandbox
Buy one get one free: calculate the basket, then refund 1 unit of line-1 from the frozen snapshot. Free test key, no card.
The button keeps this payload in your browser and opens your dashboard (sign in with your email first if you are not already), where it is ready to run with your vl_test_ key.
Change the numbers and watch the refund
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.