Price negotiation
A shopper tells their agent: "Can you get me a better price? It's $18.99 elsewhere." The agent calls one tool, Snappy decides on its own within bounds its operators set, and the agent relays the answer: a match, a counter-offer or a polite no. If the shopper agrees, the offer becomes a normal 15-minute quote with the discount applied and checkout proceeds as usual; Stripe charges the discounted total.
negotiate_price { variantId, competitorPrice, competitorUrl, message }
│
▼
neg_ offered (decision accept | counter) ──(shopper agrees)──▶ accept_offer ─▶ qt_ (discount applied, 15 min) ─▶ create_checkout ─▶ pay
│ └─▶ negotiation applied
├─▶ rejected (decision reject; list price applies; the shopper can bring evidence and try again)
├─▶ expired (offerTtlMinutes passed; negotiate again)
└─▶ superseded (a later round replaced it; use the latest negotiation)
stateDiagram-v2 [*] --> offered: decision accept or counter [*] --> rejected: decision reject, the list price stands offered --> applied: accept_offer or createQuote with negotiationId, quoteId set offered --> expired: offerTtlMinutes passed, marked on the next read offered --> superseded: a later round for the same item replaced it offered --> offered: admin override with a new price and TTL, decidedBy admin offered --> rejected: admin override reject rejected --> offered: admin override with an offer expired --> offered: admin override with an offer superseded --> offered: admin override with an offer rejected --> [*]: the shopper can negotiate again, next round inside the window applied --> [*]: the quote goes to checkout, cannot be overridden expired --> [*] superseded --> [*]
The decision is made by a deterministic rules layer (the floor, price matching, rounds, expiry) and, in ai mode, by Claude reasoning inside those bounds with an optional online price check. Every step is logged and visible to operators, who can override any decision.
Agent flow
- The shopper asks for a discount, a better price or a price match. Call
negotiate_price(REST:POST /v1/negotiations) with the variant and everything the shopper gave you: the price they want (requestedPrice), the competitor's price (competitorPrice), a link to the listing (competitorUrl), the store (competitorName) and their own words (message). A link is the strongest evidence because the platform verifies it. - Relay
messageto the shopper verbatim. It is written as Snappy speaking to the shopper and states the new price.nextSteptells you what to do next. Never promise a price the tool did not return. - If the shopper agrees, call
accept_offer(REST:POST /v1/negotiations/{id}/accept) beforeexpiresAt. It returns the negotiation (nowapplied) and a quote whosetotalAmountalready includes the discount.create_quotewithnegotiationIddoes the same thing. - Check out with that quote like any other (
create_checkout), then poll, receipt, track: see Checkout flow. - If the shopper comes back with a lower ask or new evidence, call
negotiate_priceagain withpreviousNegotiationIdto open the next round. Rounds are capped (maxRounds); the previous offer is markedsuperseded.
Repeating the same ask while an offer is open returns that same offer (idempotent). The offer is tied to the shopper, the variant and the country it was priced for.
REST
Scopes: orders:write for createNegotiation and acceptNegotiation, orders:read for getNegotiation and listNegotiations. Tool class write for the former, read for the latter (see Tool classification).
| Operation | Method and path | Returns |
|---|---|---|
createNegotiation |
POST /v1/negotiations |
201 Negotiation |
listNegotiations |
GET /v1/negotiations?limit= |
{ negotiations: [...] }, the user's, newest first |
getNegotiation |
GET /v1/negotiations/{id} |
Negotiation (an expired offer is marked expired on read) |
acceptNegotiation |
POST /v1/negotiations/{id}/accept |
201 { negotiation, quote } |
createQuote |
POST /v1/quotes { variantId, countryCode?, negotiationId? } |
Quote with discountAmount and negotiationId set |
Request
| Field | Notes |
|---|---|
variantId |
Required. The item being negotiated |
countryCode |
ISO-2; defaults to the user's country. The offer is priced for this country only |
requestedPrice |
The item price the shopper wants, in major units (18.99) |
competitorPrice |
A lower price the shopper found elsewhere, major units |
competitorUrl |
Absolute https URL of the competitor listing on a public website. The platform fetches it and reads the listed price |
competitorName |
Store name, up to 100 characters |
message |
The shopper's own words about the price, up to 2000 characters |
previousNegotiationId |
Continue a previous negotiation as the next round |
Example: price match with a competitor link
The shopper wants a $21.99 candle warmer lamp for $17.99 and says Target lists it at $18.99. In this example operators allow up to 15 % off (maxDiscountPercent: 15, floor $18.69) and run ai mode; the model matches the verified competitor price rather than drop to the floor.
H="authorization: Bearer $TOKEN"
curl -H "$H" -H 'content-type: application/json' -X POST $BASE/v1/negotiations -d '{
"variantId": "var_8f2c1",
"requestedPrice": 17.99,
"competitorPrice": 18.99,
"competitorUrl": "https://www.target.com/p/candle-warmer-lamp/-/A-91234567",
"competitorName": "Target",
"message": "Can you do $17.99? Target has it for $18.99."
}'
{
"id": "neg_01j9x4k7m2",
"status": "offered",
"decision": "counter",
"round": 1,
"variantId": "var_8f2c1",
"productId": "prod_5d1a",
"productTitle": "Candle Warmer Lamp",
"variantTitle": "Matte black",
"imageUrl": "https://cdn.snappy.com/products/candle-warmer-lamp.jpg",
"countryCode": "US",
"currency": "USD",
"listPrice": 2199,
"listPriceDisplay": "$21.99",
"listTotal": 2798,
"requestedPrice": 1799,
"competitorPrice": 1899,
"competitorUrl": "https://www.target.com/p/candle-warmer-lamp/-/A-91234567",
"competitorName": "Target",
"offerPrice": 1899,
"offerPriceDisplay": "$18.99",
"offerTotal": 2498,
"offerTotalDisplay": "$24.98",
"discountAmount": 300,
"discountPercent": 13.6,
"message": "Good news: Target does list the Candle Warmer Lamp at $18.99, so we'll match it. Your price is $18.99 instead of $21.99, $3.00 off. We can't go to $17.99 on this one. The offer is valid for 30 minutes; say the word and we'll lock it in.",
"evidence": [
{
"source": "competitor_url",
"url": "https://www.target.com/p/candle-warmer-lamp/-/A-91234567",
"title": "Candle Warmer Lamp - Matte Black : Target",
"price": 1899,
"currency": "USD",
"verified": true,
"note": "listed price read via jsonld"
}
],
"decidedBy": "ai",
"expiresAt": "2026-10-11T15:42:10.000Z",
"quoteId": null,
"nextStep": "Relay `message` to the user. If they agree, call acceptNegotiation (or createQuote with negotiationId) before expiresAt, then checkout as usual."
}
Amounts in the response are minor units (2199 = $21.99); *Display fields are formatted for the shopper. listTotal is the all-in price before the discount (item + shipping + duties + service fee for one unit); offerTotal is the same total after the item discount. With the default 10 % cap the same request would be countered at the floor, $19.79.
Accept the offer
curl -H "$H" -X POST $BASE/v1/negotiations/neg_01j9x4k7m2/accept
# -> 201 { negotiation: { ..., status: "applied", quoteId: "qt_01j9x5…" },
# quote: { id: "qt_01j9x5…", itemAmount: 2199, shippingAmount: 599, discountAmount: 300, negotiationId: "neg_01j9x4k7m2", totalAmount: 2498, totalDisplay: "$24.98", expiresAt: … } }
curl -H "$H" -X POST $BASE/v1/checkouts -d '{ "items": [ { "quoteId": "qt_01j9x5…" } ], "recipient": { … }, "shippingAddress": { … } }'
The quote behaves exactly like a quote without a negotiation: 15-minute lock, one per cart line, quote_expired after that. Accepting an offer twice returns negotiation_already_applied with the existing quoteId.
Negotiation object
| Field | Meaning |
|---|---|
id, round, variantId, productId, productTitle, variantTitle, imageUrl, countryCode, currency |
Identity and the item priced |
status |
offered, rejected, applied, expired, superseded |
decision |
accept (the ask was met), counter (a different price), reject (list price stands) |
listPrice, listPriceDisplay, listTotal |
Item price and all-in total before the discount, minor units |
requestedPrice, competitorPrice, competitorUrl, competitorName |
What the shopper asked for and cited, minor units |
offerPrice, offerPriceDisplay, offerTotal, offerTotalDisplay |
The offered item price and resulting all-in total; null on reject |
discountAmount, discountPercent |
Item discount in minor units and as a percentage (13.6) |
message |
Customer-facing text. Relay verbatim |
evidence[] |
{ source, url?, title?, price?, currency?, verified, note? }. Sources: competitor_url (fetched and read), shopper_claim (price without a link), web_search (pages the model consulted) |
decidedBy |
rules, ai or admin |
expiresAt |
When the offer stops being acceptable |
quoteId |
Set once the offer is applied |
nextStep |
What the agent should do now |
MCP tools
| Tool | Class | Scope | Input | Returns |
|---|---|---|---|---|
negotiate_price |
write | orders:write |
Same fields as POST /v1/negotiations |
Negotiation |
get_negotiation |
read-only | orders:read |
{ negotiationId } |
Negotiation |
accept_offer |
write | orders:write |
{ negotiationId } |
{ negotiation, quote } |
create_quote |
write | orders:write |
{ variantId, countryCode?, negotiationId? } |
Quote; negotiationId applies an open offer |
The MCP server's instructions already tell hosts: when the user asks for a discount, a better price or a price match, call negotiate_price with the evidence they gave, relay its message verbatim, and on agreement call accept_offer (or create_quote with negotiationId) before it expires. See MCP endpoint.
How a decision is made
Every negotiation goes through the same pipeline, and every step writes an event you can read in the admin portal.
request ─▶ evidence (competitor URL check) ─▶ rules (floor, price match, rounds) ─▶ AI (ai mode only) ─▶ clamp into [floor, list] ─▶ decided
flowchart TD
req["negotiate_price or POST /v1/negotiations: variantId, requestedPrice, competitorPrice, competitorUrl, competitorName, message, previousNegotiationId"] --> guard{"negotiation enabled, user active, variant available in the country?"}
guard -->|no| err["409 negotiation_disabled, 403 user_suspended or 422 variant_unavailable_in_country"]
guard -->|yes| round["round: previousNegotiationId or an open conversation inside offerTtlMinutes continues (the prior offer is superseded), an identical open ask returns the same offer"]
round --> ev{"competitorUrl given and verifyCompetitorUrl on?"}
ev -->|yes| fetch["fetch the page server-side (https only, public hostnames resolving to public addresses, redirects re-checked, 5 s, 1 MB) and read the price from JSON-LD, meta tags, microdata or text"]
fetch --> evres["evidence.verified when the page price is within 2% or 0.50 of the claim in the quote currency, otherwise evidence.mismatch or evidence.unverified"]
ev -->|no| claim["a competitorPrice without a link is an unverified shopper_claim"]
evres --> rules
claim --> rules
rules["rules: floor = list minus maxDiscountPercent (per-product override, cost plus margin when allowBelowCost is off), price match, goodwill, maxRounds, then accept, counter or reject"] --> mode{"mode ai, room below list, round within maxRounds?"}
mode -->|no| decided
mode -->|yes| key{"Anthropic key configured in Integrations?"}
key -->|no| skip["ai.skipped: the rules decide"] --> decided
key -->|yes| ai["Claude through the Messages API: item, list, floor, ask, words, evidence, the rules suggestion, up to 3 web searches when onlinePriceCheck is on, answer through the submit_decision tool"]
ai -->|"error or timeout"| fail["ai.failed: the rules decide"] --> decided
ai --> clamp["clamp the price into floor..list, recompute accept, counter or reject"] --> decided
decided["decided: neg_ offered or rejected, expiresAt = now + offerTtlMinutes, customer message, every step in the event log"]
decided --> accept["accept_offer or createQuote with negotiationId before expiresAt"] --> quote["qt_ with discountAmount, 15 min lock, negotiation applied"] --> checkout["create_checkout, Stripe charges the discounted total"]
decided -.->|"admin override: a new offer at any price down to zero, or a rejection, with a note"| decided
1. Evidence
If competitorUrl is given and verifyCompetitorUrl is on, the platform fetches the page server-side (https only, public hostnames that resolve to public addresses, up to three redirects each re-checked, 5 s timeout, 1 MB cap) and reads the listed price from, in order: JSON-LD Offer/AggregateOffer, Open Graph or meta product tags (product:price:amount, og:price:amount), microdata itemprop="price", then a conservative text scan for a $12.34 near the word "price". The claim is verified when the page price is within 2 % (or $0.50, whichever is larger) of competitorPrice and in the quote's currency; if no competitorPrice was given the page price becomes the claim. Events: evidence.verified, evidence.mismatch (page says something else), evidence.unverified (could not fetch or read, with the reason). A competitor price without a link is recorded as an unverified shopper_claim.
2. Rules (deterministic)
Pure functions over minor-unit amounts, configured by operators (table below). They fix the bounds the AI must respect and produce a decision of their own:
- Floor = list item price minus
maxDiscountPercent(a per-product override can change the percentage or disable negotiation for that product). WithallowBelowCostoff, the floor is never below Snappy's landed item price plusminMarginPercent. - Price match: with
priceMatchon and a competitor price below list, offer the competitor price (minusbeatByPercentif set), or the shopper's ask if lower, clamped to the floor. WhenrequireVerifiedEvidenceis on, unverified claims are ignored (evidence.unverified_ignored). - Goodwill: an ask with no evidence gets
goodwillDiscountPercent(default 0, which rejects withask.no_evidence); a request with neither ask nor evidence gets the goodwill discount orno_basis. - Guards:
rounds.exhaustedpastmaxRounds;ask.at_or_above_listwhen the ask is not below the price;floor.at_listwhen there is no room. - The outcome is
acceptwhen the bounded price meets the ask (or the competitor price when no ask was given),counterwhen it is higher,rejectwhen there is no discount. Rule identifiers fire in order (floor.max_discount:15%,price_match,clamp:1799->1869, …) and are stored on the negotiation asrulesApplied.
In rules mode this is the final decision and the customer message is a fixed template.
3. AI (ai mode)
Claude (aiModel, default claude-sonnet-5-5, called through the Anthropic Messages API with the key from Integrations) receives the item, list price, floor, maximum discount, the shopper's ask and words, the evidence gathered so far, the round, and the rules' own decision to confirm or improve on. With onlinePriceCheck on it may run up to 3 web searches for the going price of the exact item at reputable retailers; pages it consults are appended to evidence as web_search. It returns accept / counter / reject, an item price, operator-facing reasoning and the customer message, via a forced tool call so the output is structured. The system prompt (aiPrompt) is editable in Settings.
4. Clamp
The platform clamps the model's price into [floor, list] and records any adjustment on the ai.decided event (clamped: ["raised 1750 to floor 1869"]). The decision is then recomputed from the clamped price (met the ask → accept, otherwise counter; no discount → reject). If no Anthropic key is configured the rules' decision stands (ai.skipped); if the call fails or times out, likewise (ai.failed, with the error). The model can therefore never grant more than the rules allow, including when a shopper's message tries to instruct it.
Money
The item discount is subtracted from the all-in total of the resulting quote; shipping, duties and the service fee are unchanged. Snappy, as the merchant, is paid its landed item price and sells the discount out of its own margin; allowBelowCost (on by default) is how Snappy decides whether an offer may go under the landed price, and minMarginPercent how much margin to keep when it may not.
Settings
Admin portal → Settings → Price negotiation. Changes apply within 10 seconds (settings cache); no redeploy.
| Setting | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch. Off: negotiate_price returns negotiation_disabled and the catalog price applies |
mode |
ai |
rules: deterministic only. ai: rules set the bounds, the model reasons inside them |
maxDiscountPercent |
10 |
Largest discount on the item price (0-90). Defines the floor |
goodwillDiscountPercent |
0 |
Discount for an ask with no evidence. 0 = reject such asks |
priceMatch |
true |
Match a competitor's lower price (down to the floor) when evidence is given |
beatByPercent |
0 |
Go below a matched competitor price by this much (0-50); 0 = match exactly |
requireVerifiedEvidence |
false |
Only count competitor claims that were verified (URL check) |
allowBelowCost |
true |
Let the offer go below Snappy's landed item price |
minMarginPercent |
0 |
With allowBelowCost off, keep at least this margin over cost |
maxRounds |
2 |
Counter-rounds one shopper gets per item (1-5) |
offerTtlMinutes |
30 |
How long an offer can be accepted (5-1440). The quote created from it lasts 15 minutes |
verifyCompetitorUrl |
true |
Fetch a cited competitor URL and read the listed price |
onlinePriceCheck |
true |
Let the model search the web (up to 3 searches) before deciding; ai mode only |
aiModel |
claude-sonnet-5-5 |
Anthropic model id |
aiPrompt |
built-in | The system prompt (up to 8000 characters). The default asks for fair, honest price matching of identical items sold new by reputable retailers, ignoring used, bundle, membership and coupon prices |
overrides[] |
[] |
Per product: { productId, enabled?, maxDiscountPercent? } |
Errors
RFC 9457 problem details with a stable code, like every other error (see Error codes).
| Code | HTTP | Meaning | What the agent should do |
|---|---|---|---|
negotiation_disabled |
409 | Negotiation is switched off | Tell the shopper the catalog price applies; supportUrl is included |
negotiation_not_found |
404 | Unknown id, or another user's negotiation | Check the id |
negotiation_not_open |
409 | The offer is rejected, expired, superseded (extra status) |
Negotiate again for a fresh offer |
negotiation_already_applied |
409 | A quote was already created from this offer (extra quoteId) |
Use that quote |
negotiation_variant_mismatch |
400 | previousNegotiationId or negotiationId refers to a different item |
Negotiate the right variant |
negotiation_country_mismatch |
400 | The offer was priced for another country | Negotiate again with the right countryCode |
negotiation_unavailable |
400 | negotiationId passed to createQuote on a server without the negotiator wired |
Create the quote without it |
variant_unavailable_in_country |
422 | Snappy cannot ship this variant there right now | Offer another variant or country |
user_suspended |
403 | The account cannot negotiate | Point the shopper to support |
offer_out_of_range |
400 | Admin override price outside [0, list] (admin only) |
n/a |
Validation of the body (competitorUrl not an absolute URL, non-positive prices, countryCode not two letters) fails with the usual 400 validation_error.
Admin portal
| Page | What you can do |
|---|---|
| Settings → Price negotiation | Every knob in the table above, the AI system prompt, per-product overrides |
| Integrations → Anthropic (negotiation AI) | API key (write-only, stored in Secret Manager as anthropic-api-key, rotatable), optional API base URL, Test connection. Without a key the negotiator runs on rules only |
| Negotiations | Every negotiated item: list → offer, discount, decision, decided by (rules / ai / admin:<operator>), round, status, shopper. Filter by status |
| Negotiation detail | The shopper's ask and words, competitor evidence with the verification result, rules applied in order, AI model, token usage and reasoning, the customer message, and the full event log |
| Dashboard | Negotiation counts (total, last 7 days, by status) and the average applied discount |
Event log types: requested, evidence.verified / evidence.mismatch / evidence.unverified, rules.evaluated, ai.decided / ai.failed / ai.skipped, decided, applied, expired, superseded, admin.override.
Override: from the detail page an operator can issue a new offer at any item price from zero up to list (optionally with its own TTL) or reject, with a note. The negotiation becomes offered again with decidedBy: admin, the note is appended to the reasoning, and the action is written to the event log and the audit log. An offer that is already applied cannot be overridden; cancel or refund the order instead.
Operations
- Anthropic key: Integrations → Anthropic (negotiation AI). The platform calls
POST {baseUrl}/v1/messagesdirectly (no SDK), so a rotated key takes effect on the next negotiation.mode: rulesnever calls the model. - Cost: one Messages call per negotiation in
aimode (max_tokens1500) plus up to 3 server-side web searches whenonlinePriceCheckis on; token usage is stored per negotiation (aiUsage) and shown on the detail page. TurnonlinePriceCheckoff to cut the search cost, ormode: rulesto spend nothing. Competitor URL checks are plain HTTP fetches with a 5 s timeout. - Logs:
negotiation.decided(id, decision, offer, list, decidedBy, round) on every request;negotiation.ai_failedwith the error when the model call fails and the rules took over. A run ofai.skippedevents means the key is missing or was removed; a run ofevidence.unverifiedwithfetch_failedusually means the retailer blocks the fetcher or the Cloud NAT egress IP. - Abuse: competitor URLs are fetched server-side with SSRF guards (no
localhost,.local,.internal, IP literals or dotless hosts; size and time limits). One open offer per shopper per item; repeating the identical ask returns the same offer rather than a new roll of the dice.maxRoundsbounds persistence. AI output is clamped to the rules' floor, so a prompt injection in the shopper'smessagecannot push the price under it. - Watch for: a rising share of
decidedBy: aioffers landing exactly on the floor (the model is being pushed to the limit; lowermaxDiscountPercentor turnrequireVerifiedEvidenceon), andevidence.mismatchevents on the same domain (shoppers citing a price the page does not show).