http://localhost:3000/api/widgets as the protected endpoint.
Step 1: Confirm the challenge
Start your server. Call the paid endpoint without a payment.200.
Step 2: Read the challenge with the CLI
The CLI reads the challenge. It does not pay.inflow x402 decode or inflow mpp decode.
Step 3: Pay with the CLI
The CLI usesproduction by default. Your server runs in the sandbox, so add --sandbox to each command.
1
Install the CLI and unlock the vault
See Install the CLI. Run
inflow vault unlock yourself, in your own terminal.2
Log in to the sandbox
3
Check the sandbox balance
4
Pay the endpoint
INFLOW_API_KEY to a sandbox key. Keep --sandbox on each command. See Authenticate.
Step 4: Pay with a buyer example
Run a buyer example from the inflow-node repository. The MPP buyer example works only with the sandbox. It accepts a key from a sandbox Developer account or a sandbox Seller account.- MPP
- x402
Start The default target is
mpp-seller-express or mpp-seller-hono, or your own MPP server. Then run the buyer in a second terminal.http://localhost:3000/api/widgets. To change it, set TARGET_URL in .env.A successful payment prints this output.mpp-buyer-fetch replaces the global fetch with a payment-aware wrapper. For the explicit path, read mpp-buyer-manual.Step 5: Check the result
- The pay command returns status
200and the real body from your endpoint. - The payment appears in the sandbox dashboard.
- The amount matches your price.
Troubleshooting
The CLI reports an authentication error in the sandbox
The CLI reports an authentication error in the sandbox
Tokens stay in the environment that issued them. Log in again with
--sandbox.The pay command finds no option it can pay
The pay command finds no option it can pay
Run
inflow mpp supported --sandbox or inflow x402 supported --sandbox. Compare the result with the inspect output from step 2.Every request returns 402, even after payment
Every request returns 402, even after payment
The buyer and the server use different protocols. An MPP buyer cannot pay an x402 endpoint. Run
inflow inspect on the endpoint first.403 SELLER_ACCOUNT_REQUIRED, see Errors.
Next step
Step 2: Enable agent enrollment
Let agents enroll with your service and get credentials.