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.

~1 s
for a payment to land on NEAR
No gas
for the company: a sponsor pays it
On chain
limits the agent cannot bypass

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.

NEAR testnetYour browserowner key made hereSkyPay serverinvoices · agent · exportsSponsor relayerpays the gasNotionrows ⇄ pay linksCompany accountreceives your moneyOperating vaultlimits · payee listAgent accountkey can only call vault.paysignedpay only
  • 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. 1

    Create an account

    Sign up, then connect Notion if you want it (optional). SkyPay creates a payments database in your workspace.

  2. 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. 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. 4

    Open the link and pay

    The invoice turns paid only after SkyPay verifies the transfer on NEAR.

The Finance sidebar has a Readiness tab. It shows what is left to set up and turns into a green check when everything is done.

What setup creates

1 Owner keymade in your browser2 Companyaccount, sponsored3 Vaultdeployed, keys deleted4 Agent keyallowed to call pay only

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.

Vault contract (checked on chain)Agentasks to payPayee approved?on the allowlistnoRefusedPayment limit?owner-set capnoRefusedDaily limit?owner-set capnoRefusedyesPaidon chain
  • 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.
The point: the refusal comes from the chain, not from SkyPay. A bug or a bad prompt on our side cannot raise the limit.

Invoices and settlement

InvoicependingPay linkclient opens itTransfertUSDC + memoVerifyon-chain checkPaidrecord + link

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.

unknown supplier
no registered supplier with that email or account
payout changed
typed account differs from the registry
possible duplicate
same supplier, number or amount within 30 days

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.

Paying agentSkyPay /x402payNEARGET /x402pay/<invoiceId>402 + amount, token, receiversigns one ft_transferretry + X-PAYMENT headerrelay (SkyPay pays gas)transfer event on chain200 + 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.csv and payments.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.
Testnet only. The token has no value. Real USDC, mainnet payments and cross-chain collection with NEAR Intents are not live in this build, and no production security audit is claimed. See CLAIMS.md for what is and is not established.

API quick reference

Private routes need Authorization: Bearer <JWT>. The full reference is docs/API.md.

RouteWhat it does
GET /api/near/statusAccounts, balances, policy and readiness
POST /api/near/provisionCreate the company footprint from your owner public key (resumable)
POST /api/invoicesCreate an invoice (1 to 50 line items)
GET /api/public/invoices/:idPublic checkout details and status
POST /api/public/invoices/:id/confirmSubmit a transaction hash for verification
POST /api/vault/paymentsPay a registered payee through the vault
POST /api/vault/payout-batchesRun payroll or a batch (1 to 25 lines)
GET /api/export/invoices.csvInvoices for your accountant
GET /x402pay/:idx402 pay link for an invoice