See the Visa sample repository.
The full sample registry and merchant route inventory, plus schemas and proxy behavior at a pinned revision.
Sample merchant APIs · 23 route definitions
Default direct origin: http://localhost:8000. Proxy origin is configurable; README examples use localhost:3001. Tables below come from route source at the pinned sample revision.
- GET /api/products/
Purpose / source: Search and filter products
Route sourceInputs:
query(query, string, optional): Search query for product name or description
category(query, string, optional): Filter by category
min_price(query, number, optional): Minimum price filter
max_price(query, number, optional): Maximum price filter
limit(query, integer, default 20, 1 to 100): Number of products to return
offset(query, integer, default 0, at least 0): Number of products to skipSuccess / explicit refusal statuses:
200 · ProductList
Explicit refusals: none in this handler- GET /api/products/{product_id}
Purpose / source: Get a specific product by ID
Route sourceInputs:
product_id(path, int)Success / explicit refusal statuses:
200 · Product
Explicit refusals: 404- POST /api/products/
Purpose / source: Create a new product (admin functionality)
Route sourceInputs:
product(JSON body, ProductCreate)Success / explicit refusal statuses:
200 · Product
Explicit refusals: none in this handler- POST /api/cart/
Purpose / source: Create a new cart with a unique session ID
Route sourceInputs: None
Success / explicit refusal statuses:
200 · Cart
Explicit refusals: none in this handler- GET /api/cart/{session_id}
Purpose / source: Get cart by session ID
Route sourceInputs:
session_id(path, str)Success / explicit refusal statuses:
200 · Cart
Explicit refusals: 404- POST /api/cart/{session_id}/items
Purpose / source: Add an item to the cart
Route sourceInputs:
session_id(path, str)
item(JSON body, CartItemCreate)Success / explicit refusal statuses:
200 · Cart
Explicit refusals: 404- PUT /api/cart/{session_id}/items/{product_id}
Purpose / source: Update the quantity of an item in the cart
Route sourceInputs:
session_id(path, str)
product_id(path, int)
item_update(JSON body, CartItemUpdate)Success / explicit refusal statuses:
200 · Cart
Explicit refusals: 404- DELETE /api/cart/{session_id}/items/{product_id}
Purpose / source: Remove an item from the cart
Route sourceInputs:
session_id(path, str)
product_id(path, int)Success / explicit refusal statuses:
200 · Message
Explicit refusals: 404- DELETE /api/cart/{session_id}
Purpose / source: Clear all items from the cart
Route sourceInputs:
session_id(path, str)Success / explicit refusal statuses:
200 · Message
Explicit refusals: 404- POST /api/cart/{session_id}/checkout
Purpose / source: Checkout cart and create an order with payment processing
Route sourceInputs:
session_id(path, str)
checkout_data(JSON body, dict)Success / explicit refusal statuses:
200 · Inline JSON
Explicit refusals: 400, 404- POST /api/cart/{session_id}/finalize
Purpose / source: Finalize cart with shipping, tax, coupons etc and return 402 Payment Required
Route sourceInputs:
session_id(path, str)
finalize_data(JSON body, CartFinalizeRequest)Success / explicit refusal statuses:
402 · CartFinalizeResponse
Explicit refusals: 400, 404- POST /api/cart/{session_id}/fulfill
Purpose / source: Fulfill cart after payment confirmation
Route sourceInputs:
session_id(path, str)
payment_data(JSON body, CartFulfillRequest)Success / explicit refusal statuses:
200 · CartFulfillResponse
Explicit refusals: 400, 404- POST /api/cart/{session_id}/x402/checkout
Purpose / source: Machine-to-machine x402 checkout endpoint
Route sourceInputs:
session_id(path, str)
checkout_data(JSON body, dict)Success / explicit refusal statuses:
200 · Inline JSON
Explicit refusals: 400, 402, 404, 500, 503- GET /api/orders/
Purpose / source: Get orders with optional filtering
Route sourceInputs:
customer_email(query, str = None)
status(query, str = None)
limit(query, int = 20)
offset(query, int = 0)Success / explicit refusal statuses:
200 · OrderList
Explicit refusals: none in this handler- GET /api/orders/{order_id}
Purpose / source: Get a specific order by ID
Route sourceInputs:
order_id(path, int)Success / explicit refusal statuses:
200 · Order
Explicit refusals: 404- GET /api/orders/number/{order_number}
Purpose / source: Get a specific order by order number
Route sourceInputs:
order_number(path, str)Success / explicit refusal statuses:
200 · Order
Explicit refusals: 404- PUT /api/orders/{order_id}/status
Purpose / source: Update order status
Route sourceInputs:
order_id(path, int)
status(query, str)
Status values: pending, confirmed, shipped, delivered, cancelled (see source).Success / explicit refusal statuses:
200 · Order
Explicit refusals: 400, 404- DELETE /api/orders/{order_id}
Purpose / source: Cancel an order (only if status is pending or confirmed)
Route sourceInputs:
order_id(path, int)Success / explicit refusal statuses:
200 · Message
Explicit refusals: 400, 404- POST /api/auth/verify-signature
Purpose / source: Verify the signature from a trusted agent.
Route sourceInputs:
verification_request(JSON body, SignatureVerificationRequest)Success / explicit refusal statuses:
200 · SignatureVerificationResponse
Explicit refusals: 400- GET /api/auth/check-verification
Purpose / source: Check if request was verified by CDN/Proxy
Route sourceInputs: None
Success / explicit refusal statuses:
200 · Inline JSON
Explicit refusals: none in this handler
FastAPI automatically exposes /docs, /redoc and /openapi.json. Schema validation can return 422 on typed inputs. Premium / x402 handlers in this sample belong to its demo payment flow; Visa CLI’s current wallet rail is Tempo/MPP.
Sample Agent Registry · 11 route definitions
README advertises port 8080; the sample’s main.py runs uvicorn directly on port 9002. Use the configured origin. Most IDs here are integers and key IDs are caller-defined strings.
- ON_EVENT startup
Purpose: Initialize database on startup
Inputs: None
Success response:
200 · Inline JSON- POST /agents/register
Purpose: Register a new agent or update existing agent for the domain
Inputs:
agent(JSON body, AgentCreate)Success response:
200 · AgentResponse- GET /agents/{agent_id}
Purpose: Get agent information by agent ID
Inputs:
agent_id(path, int)Success response:
200 · AgentPublicInfo- GET /agents/{agent_id}/keys/{key_id}
Purpose: Get specific key for an agent by agent ID and key ID
Inputs:
agent_id(path, int)
key_id(path, str)Success response:
200 · Inline JSON- POST /agents/{agent_id}/keys
Purpose: Add a new key to an existing agent
Inputs:
agent_id(path, int)
key(JSON body, AgentKeyCreate)Success response:
200 · AgentKeyResponse- GET /keys/{key_id}
Purpose: Get key information by key ID only (without requiring agent ID)
Inputs:
key_id(path, str)Success response:
200 · Inline JSON- GET /agents
Purpose: List all registered agents (optionally active only)
Inputs:
active_only(query, bool)Success response:
200 · list[AgentPublicInfo]- PUT /agents/{agent_id}
Purpose: Update specific fields of an existing agent
Inputs:
agent_id(path, int)
agent_update(JSON body, AgentUpdate)Success response:
200 · AgentResponse
Read routes enforce active flags stored as strings "true" / "false". Register updates an existing domain instead of making VARS’s duplicate-domain promise. The sample provides a direct key-only GET /keys/{key_id} route used by the CDN proxy.
Sample merchant request / response schemas
Checkout routes taking a plain dict define their actual fields in the route function, not a closed Pydantic model. See the linked checkout source for its customer/payment or delegation fields. Lists defaulting to [] are reproduced from the sample.
Sample agent-registration schemas
Ed25519 sample keys are base64 raw 32-byte public keys; RSA keys are literal PEM. The sample’s key formats, activation strings and route prefixes must be evaluated against its own schema.
Sample CDN / frontend routes and code caveats
| Route / component | Behavior |
|---|---|
GET /test-proxy | Proxy diagnostic route. |
/api/* | Proxied to the merchant backend; verify against server.js configuration. |
/* | Frontend proxy / signature verification middleware. |
| Merchant frontend | Product / cart / checkout / orders pages; UI routes are distinct from backend APIs. |
| TAP Agent | Streamlit signing/browser sample; it is not a VDP VARS registration client. |
The sample signature examples omit some required production TAP parameters. The TAP Agent README also calls Ed25519 “post-quantum resistant”; that statement is incorrect. Use RFC 9421 and the required signature fields, plus Visa CLI’s explicit profile, when writing integration code.