Start

Sandbox vs live

Every workspace is either a sandbox or a live workspace, fixed when it is created. The API is the same in both; what changes is whether money is real.
Code samples in

Two kinds of workspace#

SandboxLive
MoneySimulated sUSDC on CortexPay's ledgerUSDC on Elysium or HyperEVM
SettlementNever broadcast; references start with sim_On-chain transfer, verified by transaction hash
SignaturesReal EIP-712 signatures from a sandbox signerThe owner approves and signs each payment in their own wallet
API keyscpk_test_…cpk_live_…
Labels in the appSimulated badges on every balance and paymentNo simulated badges
Status on this deploymentAvailableEnabled

Sandbox#

  • Sandbox agents hold simulated sUSDC. Owners top them up from the agent page; nothing leaves the ledger.
  • Sandbox services are real x402 endpoints served by this deployment at /x402/sandbox/:slug. They return a genuine 402 with a PAYMENT-REQUIRED header and verify the EIP-712 signature you send back.
  • Seeded demonstration history is labelled “Seeded demo history” in the app and flagged seeded: true in the API.
  • A guest sandbox (no wallet) is removed seven days after it was created. Connecting a wallet keeps it.

Live#

A live workspace pays real USDC on Elysium or HyperEVM from the workspace owner's wallet. Agents propose payments and the policy checks them, but every live payment then waits for the owner, who approves it and signs it in their wallet: CortexPay holds no key and never holds funds. The provider settles the payment with its x402 facilitator; no public facilitator lists these chains, so CortexPay runs one providers can use (see CortexPay's facilitator).

  1. The agent requests a service with the same API as in the sandbox.
  2. CortexPay reads the provider's 402, quotes it and runs the ten policy checks, reading the owner's USDC balance on chain. A payment that fails a check is refused here.
  3. Because the money is the owner's, a payment that passes waits for approval (requires_approval): it shows in Approvals, in notifications and as an approval.requested webhook.
  4. The owner clicks Approve and sign in the wallet they signed in with. The wallet shows the exact authorization: amount, recipient and time window. Elysium USDC is paid through Permit2, so a payment there may first ask for a Permit2 approval of exactly that amount (gas in HYPE).
  5. CortexPay checks the signature, sends the paid request and marks the payment delivered only after it finds the transfer on chain.
  • Only the wallet the money comes from can approve and sign. Any owner or admin can reject.
  • If the provider's signing window runs out before the owner signs, approving again issues a fresh authorization, for as long as the approval request is open (60 minutes).
  • Autonomous live payments, from agent accounts with an on-chain policy co-signer, are not available: those contracts are not deployed, and will not be before an independent security review.

Networks#

NetworkCAIP-2SettlementPayment assets
CortexPay Sandboxeip155:31337SimulatedsUSDC (eip3009)
Elysiumeip155:99901On-chainUSDC (permit2)
Elysium Testneteip155:99801On-chainNone verified
HyperEVMeip155:999On-chainUSDC (eip3009, permit2)
HyperEVM Testneteip155:998On-chainNone verified

The details of each network's payment method are on x402 payment flow.

Infrastructure credits#

Credits pay CortexPay's own fees. They are not money: they cannot be withdrawn, transferred or paid to a provider, and service prices are always paid in the stablecoin the service asks for. The default prices:

ActionCreditsNotes
Payment authorized1Refunded when the payment never settles (refused, failed, expired or cancelled).
Agent registered10Charged once.
AI question, AI report, policy suggestion5 / 20 / 5Configured prices; not charged yet.
Starting balance1000 sandbox · 100 liveGranted when a workspace is created.

The prices in force are returned by GET /api/credits/balance as costs. Sandbox workspaces can top up for free (+500, at most five times in 24 hours, up to 5,000).

import { CortexPay } from "@cortexpay/sdk";

const cortex = new CortexPay({ apiKey: process.env.CORTEXPAY_API_KEY!, baseUrl: "https://cortexpay.vercel.app" });
const credits = await cortex.credits.balance();
console.log(credits.balance, credits.costs);
  • GET/api/credits/balance

    Credit balance, what each action costs and 30-day usage. Any key, no scope.

    Any key

  • GET/api/credits/transactions

    Credit ledger, newest first (?reason=&limit=&cursor=).

    Any key

  • POST/api/credits/topup

    Free sandbox allowance (+500, at most 5 per 24 h, capped at 5,000).

    Session · 10/min