x402-rebooker

The cancel-worse-book-better move, automated. Post a booking you already hold; one paid call scans live inventory for the same trip and returns a signed improvement report — ranked candidates, savings net of your cancellation fee, and the exact order to rebook in.

USDC on BaseUSDC on SolanaHTTP 402Apache-2.0AmadeusRIDBsigned reports

Pay on either rail — your client picks. Every 402 challenge lists USDC on Base and USDC on Solana at the same price.

git clone https://github.com/nirholas/x402-rebooker && cd x402-rebooker
npm install && cp .env.example .env   # pre-filled — runs with no edits
npm run dev                            # http://localhost:4043

Pricing

RoutePriceReturns
POST /scan$0.01Signed report: candidates, savings, rebookSteps, verdict
GET /sourcesfreeWhich inventory providers are live here
POST /verifyfreeSignature check for any report
GET /healthzfreeLiveness + accepted rails

Payment rails

USDC on Base

EIP-3009 transferWithAuthorization, signed in the wallet. Nothing on-chain until the facilitator settles.

network
base-sepolia (default) · base
payTo
0x40252CFDF8B20Ed757D61ff157719F33Ec332402
facilitator
https://x402.org/facilitator

USDC on Solana

Fee-sponsored SPL transferChecked. The facilitator's feePayer covers the SOL fee — you need only USDC.

network
solana (default) · solana-devnet
payTo
WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW
facilitator
https://facilitator.payai.network

A rail with no configured address is dropped from the challenge instead of failing the request, so a single-rail deployment is a one-line change.

How a paid call works

1 · RequestPOST /scan with the booking you hold
2 · 402accepts[]: Base and Solana, same price
3 · Paypick a rail, sign, send X-PAYMENT
4 · 200signed report in-body + X-PAYMENT-RESPONSE

It tells you to hold

A scanner that always finds savings is a sales pitch. This one ranks the worse options alongside the better ones, subtracts your cancellation fee before claiming a win, and returns verdict: "hold" whenever nothing clears the threshold you set:

{
  "savings": { "grossUsd": 145.31, "cancellationFeeUsd": 75, "netUsd": 70.31, "pct": 17.1 },
  "verdict": "rebook",
  "reason": "Best option nets $70.31 after a $75 cancellation fee, clearing your $25 threshold.",
  "best": {
    "label": "B6 621 · nonstop · departs 2026-09-14T15:00",
    "improvements": ["$145.31 cheaper than what you paid", "1 fewer stop(s)"],
    "tradeoffs": ["different carrier (B6 vs AA) — loyalty status may not carry"]
  }
}

Every candidate carries tradeoffs as well as improvements, and rebookSteps always puts book the replacement first ahead of cancel the old booking — the one irreversible mistake in this whole move.

Real inventory, honest fallbacks

DomainProviderLive whenOtherwise
flightAmadeus /v2/shopping/flight-offersAMADEUS_CLIENT_ID + AMADEUS_CLIENT_SECRETdeterministic fixtures
hotelAmadeus /v3/shopping/hotel-offerssamedeterministic fixtures
campsiteRIDB /facilitiesRIDB_API_KEYdeterministic fixtures

Both keys are free, and neither is required to run the service. Fixture-backed reports say so in source, live and notes — you will never mistake one for a real scan. A live lookup that fails degrades to fixtures with a note rather than failing the paid call, so a scan you paid for always returns a report.