# x402 Swag E-commerce store for AI agents and humans. Payments settle in USDC on Base via the x402 protocol. ## How to buy (agent flow) 1. GET https://x402swag.com/api/products — list products (free) 2. POST https://x402swag.com/api/cart/add {variant_id, quantity} — returns the cart with its id Stateless carts: no cookie jar needed — pass the returned cart id on every later call as an X-Cart-Id header, "cart_id" in the JSON body, or ?cart_id= query param Find your orders: POST /api/wallet/challenge {address}, sign the exact message, POST /api/wallet/verify {nonce,signature}, then GET /api/wallet/orders with X-Wallet-Session. Free; 15-minute session. Browser: /my-orders. Delivery restriction: We do not currently deliver to the European Union (EU). 3. POST https://x402swag.com/api/checkout {email, shipping_address:{country,...}, shipping_rate_id?} — creates order 4. POST the returned payment.pay_url with an x402 client — 402 challenge at order total, sign USDC authorization, retry 5. Save order_access_key from checkout securely. Send it in X-Order-Access for private details, tracking, receipts and card checkout. Never include it in URLs. 6. GET https://x402swag.com/api/orders/{token} — limited status without the access key; private details with it. For wallet_sign_in_available orders, POST /api/orders/{token}/wallet/challenge {address}, sign its exact message, then POST /api/orders/{token}/wallet/verify {nonce,signature}. The returned order_access_key grants access for 15 minutes. Challenges are single-use and expire after 5 minutes. No payment or gas. EOA signatures only; smart-contract wallets use the checkout key. Older unbound orders require verified support. Shipping rates: GET https://x402swag.com/api/checkout/rates with country, province, city, zip and address1 query parameters. US suppliers may ship internationally; non-US suppliers are local-only. Unknown origin or failed supplier quote blocks checkout. Collections: GET https://x402swag.com/api/collections OpenAPI spec: https://x402swag.com/openapi.json One-shot paid catalog (x402, $0.05): GET https://x402swag.com/api/agent/catalog ## Custom Print Studio — bring your own design (x402-only, no card checkout) 6. GET https://x402swag.com/api/custom/menu — free: current products/colors and the preview price Products: tee-crew / tee-vneck-ladies (color = garment) and framed-poster (color = frame: Black|White|Walnut; 11x14 $59, 12x16 $69, 16x20 $89, matte paper, wood frame). Framed posters print full-bleed: pass fit:"contain" (default, white matte if the aspect differs) or fit:"cover" (fill + center-crop). Have a photo transformed first? imagegen.coinopai.com/transform ($0.75, 58 identity-preserving presets) returns an image_url you can pass straight in here. 7. POST https://x402swag.com/api/custom/designs {prompt|image_url|image_b64, product, color, fit?} — x402 ($0.50): runs generate/upscale/background-removal/quality-gate BEFORE your payment is settled and returns 201 {design_id, status:"ready", preview_url, mockup_urls, dpi, expires_at}. You are charged only for an accepted design: a moderation or quality-gate reject is 422 and an upstream failure is 502, both with charged:false (nothing settles). image_url must be a public https URL. If the mockup step fails after your payment settled you get 502 with a single-use retry_credit token (7 days): resend it as the x-retry-credit header to /regenerate to finish that design at no charge. POST https://x402swag.com/api/custom/designs/{design_id}/regenerate {prompt?} — x402 ($0.50), new attempt, same product/color; charged only when it delivers an accepted design (same 422/502 rules) 8. POST https://x402swag.com/api/custom/designs/{design_id}/approve {approved:true} — free. Required before cart add. AI-generated designs can contain mistakes (odd text, extra fingers, stray marks). The preview is exactly what will print — approving it is final, no changes or refunds on the design itself. Printing defects (misprints, damage) are covered by the printer's reprint guarantee: file a claim at https://x402swag.com/pages/custom-claims within 30 days of delivery, with a photo. Returns {variant_id, variants[]} — a normal variant for the flows below. 9. Unapproved designs expire 24h after generation. From here it's the normal flow above (cart/add -> checkout -> pay) except custom items are x402-only — no Stripe/card option.