SkyPay docs
An AI agent runs your payments, and it cannot overspend. Everything below runs on NEAR testnet with a test token (tUSDC) that has no value.
Overview
SkyPay is a finance workspace for a small business. You bill clients in USDC on NEAR, pay approved suppliers and staff from a vault, and export the books to CSV. An AI agent can create invoices and pay suppliers, but only inside spending rules that a NEAR smart contract enforces, not our server.
Architecture
Three NEAR accounts keep authority separate. You hold the owner key in your browser. The vault holds the money the agent may spend. The agent holds a key that can do one thing: ask the vault to pay.
- Company account receives invoice payments. Its key lives in your browser and is never sent to SkyPay.
- Operating vault is a Rust contract. After deploy its own keys are deleted, so only its rules can move funds.
- Agent account has a key that can only call
vault.pay. - Sponsor relayer pays NEAR gas for your signed actions, so the company never buys NEAR.
Getting started
- 1
Create an account
Sign up, then connect Notion if you want it (optional). SkyPay creates a payments database in your workspace.
- 2
Create the company NEAR account
Open Finance and click Create company NEAR account. Your owner key is generated in this browser. Keep the backup it offers.
- 3
Make an invoice, or ask the agent
Create one on Finance, or tell the agent on the Dashboard: "Invoice Acme Corp 25 USDC, due Friday".
- 4
Open the link and pay
The invoice turns paid only after SkyPay verifies the transfer on NEAR.
What setup creates
SkyPay sponsors the account, the vault and a limited agent key on testnet. Setup is resumable: if it is interrupted, clicking again continues the same accounts with the same owner key rather than creating duplicates. The browser also refuses a wrong key backup before storing it.
Spending guardrails
Every payment the agent makes goes through the vault contract. The contract checks the payee and both limits. If any check fails, nothing moves and the vault refuses.
- Approved payees only. A supplier must be allowlisted by the owner. An address-book entry alone is not approval.
- Per-payment and daily limits are set by the owner and checked on chain.
- Revocation. The owner can stop the agent at any time.
- No blind resends. A request key makes a repeated payment the same payment, and uncertain payments are reconciled, not resent.
Invoices and settlement
An invoice has line items, a due date, a public checkout page and a status (pending or paid) with explorer links. Refunds are not built. It becomes paid only when SkyPay finds a successful transfer that meets all of these:
- the pinned token contract, on the active network;
- the full amount, to the company account, and not refunded in the same transaction;
- a memo that matches this invoice;
- a transaction that has not already paid another invoice.
Anyone can pay a correctly tagged invoice. A quote or a detected deposit is never treated as proof of payment.
Suppliers and payroll
Suppliers send bills through a private inbox link. SkyPay matches each bill to a registered supplier and raises flags for anything unusual. You review, then the vault pays the registered account, never an account typed on the bill.
Payroll runs as a batch of 1 to 25 lines under a deliberate name. A name can be used once, so a repeated click cannot pay everyone twice. If any line is uncertain, the run stays open and is reconciled instead of being called failed.
The agent
The agent works through a small set of typed tools. It cannot run arbitrary actions.
- Create an invoice and read its status.
- List payees and pay a supplier.
- Summarise the books.
Try: Invoice Acme Corp 25 USDC, due Friday or Pay Bo & Co 12 USDC for the March bill. Tools propose actions through SkyPay services, and the vault stays the final authority.
x402 pay links
Every invoice also has /x402pay/<invoiceId>, so other AI agents can pay it without a browser. Called without payment it answers HTTP 402 with the requirements. The agent signs one transfer and retries with an X-PAYMENT header. SkyPay relays it, verifies it on chain and returns the receipt.
The facilitator endpoints are /x402/supported, /x402/verify and /x402/settle. The network name near-testnet is SkyPay's own mapping of x402 to NEAR, not an official x402 network.
Exports and Notion
- CSV for your accountant:
invoices.csvandpayments.csv. UTC times, exact 6-decimal amounts, and a transaction link on every row. - Notion: a new row becomes a NEAR invoice, and the agent writes the pay link back to the row.
Security and limits
- SkyPay never holds the owner key. The agent key is stored encrypted and can only call the vault.
- The relayer only sponsors vault policy calls, funding your own vault, and exact-shape invoice payments.
- Invoice links are public bearer links. Anyone who has one can view that invoice.
API quick reference
Private routes need Authorization: Bearer <JWT>. The full reference is docs/API.md.
| Route | What it does |
|---|---|
| GET /api/near/status | Accounts, balances, policy and readiness |
| POST /api/near/provision | Create the company footprint from your owner public key (resumable) |
| POST /api/invoices | Create an invoice (1 to 50 line items) |
| GET /api/public/invoices/:id | Public checkout details and status |
| POST /api/public/invoices/:id/confirm | Submit a transaction hash for verification |
| POST /api/vault/payments | Pay a registered payee through the vault |
| POST /api/vault/payout-batches | Run payroll or a batch (1 to 25 lines) |
| GET /api/export/invoices.csv | Invoices for your accountant |
| GET /x402pay/:id | x402 pay link for an invoice |