{"name":"payments-as","description":"Payment rail for Agent Services. Wraps the 402-then-sweep pattern (USDC on Base) into a single dependency for seller ASs.","mcp_endpoint":"https://payments.agentserviceindex.com/mcp","openapi_url":"https://payments.agentserviceindex.com/openapi.json","instructions":"payments-as is the payment rail for Agent Services. Use it when you are building a *seller* AS (a service charging buyer agents in USDC) and don't want to roll your own ephemeral-wallet, sweep, gas-management, or transaction-ledger code. Buyer agents do not call this service; they only see the 402 your seller AS returns.\n\nONE-TIME SETUP (do this before your seller AS can take payments):\n\n1. Get a payout wallet address from the human user. This is where their revenue lands.\n   - If the user already has a Base-compatible wallet (Coinbase Wallet, Base App, Rainbow, MetaMask, etc.), ask them for the address. Any EVM address works on Base.\n   - If the user does not have a wallet, walk them through `setting-up-a-master-wallet.md` (in the payments-as repo): download the Base App (or Coinbase Wallet), create a wallet, switch the network to Base, copy the address from the QR code / Receive tab, and paste it back to you.\n   - The user keeps custody of the private key in their wallet app. You only need the *public address*. Never ask for or store the private key.\n\n2. Persist the address locally so you don't re-prompt every session. The conventional location used by other ASs in this monorepo is `~/.agent_wallets/master_wallet.json`, format `{\"address\": \"0x...\"}`. Use `chmod 600` on the file. (See the simple-crypto-agent-payments skill for the full convention.)\n\n3. Stand up a webhook endpoint on your seller AS — any HTTPS URL on your service that accepts a POST with a JSON body and returns 2xx within 5 seconds. payments-as POSTs to it on settlement; this is how you learn the buyer paid. Verify the X-Payments-Signature header (HMAC-SHA256 of the raw body using your seller_secret) before trusting the payload. Idempotency key is the invoice_id — handle redelivery.\n\n4. Call register_seller(payout_wallet, callback_url) ONCE. The response includes seller_id and seller_secret. Save both. The secret is shown only once; if lost, call register_seller again with the same payout_wallet to rotate. The secret is the bearer credential for create_invoice / get_invoice AND the HMAC key for verifying webhooks.\n\nPER-SALE FLOW:\n\n1. Buyer agent hits a paid endpoint on your seller AS.\n2. Your seller AS calls create_invoice(seller_id, seller_secret, amount_usdc, buyer_ip, metadata?). amount_usdc is what you (the seller) want to NET — the markup is added on top by payments-as. Pass the buyer's IP from the inbound request (observable, not buyer-supplied). metadata is opaque JSON we record alongside the invoice.\n3. Response: invoice_id, pay_to_address, total_amount_usdc (= amount + markup), expires_at.\n4. Your seller AS returns a 402 to the buyer agent containing pay_to_address, total_amount_usdc, chain='Base'. Same shape the simple-crypto-agent-payments skill describes — buyer's existing payment code Just Works.\n5. Buyer pays USDC on Base to pay_to_address.\n6. payments-as detects the deposit on-chain, sweeps `amount_usdc` to your payout wallet and the markup to its own wallet, then POSTs the webhook to your callback_url. End-to-end ~5–10 seconds after the buyer's tx confirms.\n7. On webhook receipt, verify the signature, look up the invoice_id, and deliver the service to the buyer (e.g. release a download token, kick off a job, return the API result on the buyer's retry).\n\nFALLBACK: get_invoice(seller_id, seller_secret, invoice_id) lets you poll if a webhook gets lost — but the chain is the source of truth, and webhooks are the primary signal. Don't skip webhook setup.\n\nCONSTRAINTS:\n- USDC on Base only (v1). One asset, one chain. Pricing is in USDC.\n- Minimum invoice size is 0.1 USDC. Below this, the take rate doesn't cover sweep gas.\n- Take rate is currently 30.00% (configurable on the deployment).\n- Invoice TTL is 30 minutes. After that, partial deposits are swept to the operator and the invoice is marked expired (no auto-refund).\n- payments-as briefly custodies the ephemeral private key between invoice creation and sweep (typically seconds-to-minute). Settlement is auditable: every webhook includes the on-chain tx_hash so the seller can verify on basescan.org.","agent_quickstart":["1. Get a Base-compatible wallet address from the human user (Coinbase Wallet / Base App / Rainbow / MetaMask).","2. Persist it locally — convention: ~/.agent_wallets/master_wallet.json, chmod 600.","3. Stand up an HTTPS webhook endpoint on your seller AS that returns 2xx within 5s.","4. Call register_seller(payout_wallet, callback_url) once. Save seller_id + seller_secret.","5. Per sale: create_invoice → return 402 to buyer with pay_to_address + total_amount_usdc.","6. On webhook receipt: verify HMAC signature, then deliver the service."],"pricing":{"currency":"USDC","chain":"Base","take_rate_bps":3000,"take_rate_pct":"30.00%","min_invoice_usdc":"0.1","model":"markup","explanation":"Seller specifies what they want to NET. payments-as adds the markup on top and quotes the buyer the total. Seller receives exactly amount_usdc; operator receives the markup."},"constraints":["USDC on Base only.","Minimum invoice: 0.1 USDC.","Invoice TTL: 30 minutes. Partial deposits past TTL go to operator (no auto-refund).","Webhook callback must respond 2xx within 5s. HMAC-SHA256 in X-Payments-Signature header."],"tools":[{"name":"register_seller","description":"Idempotent on payout_wallet. Returns seller_id + seller_secret."},{"name":"create_invoice","description":"Create a payment invoice. Returns ephemeral pay_to_address + total_amount_usdc."},{"name":"get_invoice","description":"Look up invoice status. Polling fallback; webhooks are primary."}]}