Browse documentation
AEPAY DOCUMENTATION

Understand every request.

Learn the payment lifecycle, configure spending policies, and test requests in the sandbox.

Product documentationUpdated October 8, 2026

Introduction

#

A small payment. A clearly defined boundary. A useful response.

aepay brings payment controls to AI agent workflows, with explicit budgets, per-request limits and a clear record of each decision. An agent requests a resource, receives a price, checks its policy, and continues only when the request is allowed.

Use this documentation to understand the payment lifecycle, configure the sandbox and inspect its results. Start with a request, then review spending policies, response data and integration requirements.

Available hereStatus
Product pages, documentation and searchAvailable
Budget checks, policy checks and transaction historyAvailable in the sandbox
Payment authorization and API responsesSimulated
Real payments, settlement, authentication and SDKNot available

Your first request

#

Walk through a payment lifecycle without an account or real funds.

  1. Open the interactive demo. The initial scenario is Successful request, with a $5.00 simulated budget.
  2. Choose an agent and an API. Start with Search API at $0.002 per request.
  3. Select Run request. Follow the request, payment terms, policy check, authorization, and response stages.
  4. Inspect the result and transaction log. A successful Search API call leaves $4.998. Run another request to see the totals accumulate.
  5. Try Insufficient budget or Policy rejection to explore the failure paths. Reset session clears the history and restores the current scenario's starting balance.

Open the interactive demo

How aepay works

#

The building blocks of a controlled agent payment.

ComponentRole in the sandbox
AgentA named requester. The agent selector changes its label; it does not run a real AI model.
API providerThe owner of a resource. The demo's three providers return static local sample data.
Payment termsThe illustrative price for one request, expressed in integer micro-USD.
BudgetA simulated spending allowance for the current browser session, not a wallet balance.
PolicyAn allowlist and per-call ceiling evaluated before budget is deducted.
AuthorizationThe local decision to allow a simulated charge. It is not a signature or a transfer.
SettlementThe movement of funds between parties. The sandbox does not perform settlement.

One USD equals 1,000,000 micro-USD. Search API costs 2,000 micro-USD, displayed as $0.002. The engine subtracts integers, so repeated calls do not accumulate floating-point rounding errors.

Payment lifecycle

#

A request moves forward only when both policy and budget allow it.

StageWhat happens
1. RequestThe selected agent asks for a resource from the local catalog.
2. Payment requiredThe sandbox displays the catalog price. This is an interface state, not an actual HTTP response.
3. Policy checkThe engine checks the API allowlist, per-call ceiling, and remaining budget.
4. AuthorizedAn eligible request is approved for the simulated amount.
5. DeliveredThe engine records one transaction, deducts the amount once, and displays a local sample response.

Policy is checked first. If the API is not allowed or its price exceeds the per-call ceiling, the result is policy_denied. If policy passes but the remaining balance is below the price, the result is insufficient_budget. Either rejection records an attempt with a zero charge.

Budgets & policies

#

Small amounts still deserve explicit controls.

The normal starting budget is adjustable from $1 to $100. The per-call ceiling limits the price of each individual request; it does not replace the overall budget. A request equal to the ceiling or remaining budget is allowed.

TypeScript · local policy shape
const policy = {
  maxPerCallMicroUsd: 20_000, // $0.020 per call
  allowedApiIds: ["search", "market", "inference"],
};

const initialBudgetMicroUsd = 5_000_000; // $5.00
ScenarioConfigurationExpected result
Successful request$5.00 budget; $0.020 per-call ceilingAny catalog API can pass.
Insufficient budget$0.001 budget; $0.020 ceilingAll catalog APIs exceed the budget.
Policy rejection$5.00 budget; $0.001 ceilingAll catalog APIs exceed the ceiling.

The $0.001 failure preset deliberately sits below the normal budget slider range, so you can reach the error immediately. The allowlist is part of the engine's typed policy contract; the demo uses all three APIs and exposes the per-call ceiling as its editable control.

Demo API catalog

#

Three local resources, priced to make the flow easy to inspect.

ResourceSample price / callLocal response
Search API$0.002 · 2,000 micro-USDA sample search result and result count
Market Data API$0.005 · 5,000 micro-USDA fictional SAMPLE symbol and illustrative price
AI Inference API$0.010 · 10,000 micro-USDA fixed example output and sample token count

These prices describe the demo only. They are not a commercial offer, a network fee estimate, or published pricing. No provider request is sent and no AI inference is performed. Resource paths displayed in the UI are identifiers, not callable endpoints.

JSON · simulated Search API response
{
  "results": [
    {
      "title": "Agent payment patterns",
      "source": "Sample dataset"
    }
  ],
  "count": 1,
  "simulated": true
}

Architecture

#

How the website, sandbox engine and local data fit together.

The current implementation uses Next.js App Router, TypeScript and Tailwind CSS. It exports static pages. The demo owns its state in React and delegates budget and policy decisions to a pure TypeScript engine. Documentation and search are bundled with the frontend.

Current implementation
Browser
  ├─ Home: product explanation + interactive preview
  ├─ Docs: local content + local search index
  └─ Demo: React state
       ├─ API catalog: fixed local data
       ├─ Policy check: pure TypeScript function
       ├─ Ledger: integer micro-USD
       └─ Response: local sample JSON

A live integration requires authenticated agent clients, server-side policy evaluation, a payment gateway, resource providers, a ledger and settlement services. Those services are not connected to the sandbox.

  • UI components render controls, status and transaction results.
  • src/lib/demo-engine.ts defines the catalog, policy validation and ledger updates.
  • src/content/docs.ts is the shared source for document sections and search.
  • src/config/brand.ts and tokens.css define the brand and visual system.

Data model

#

Typed, local records make every simulated charge inspectable.

TypeScript · transaction contract
type DemoTransaction = {
  id: string;
  apiId: "search" | "market" | "inference";
  amountMicroUsd: number;  // requested price
  chargedMicroUsd: number; // zero on rejection
  status: "delivered" | "insufficient_budget" | "policy_denied";
  simulated: true;
  createdAt: string;       // ISO timestamp
};

The ledger stores initialBudgetMicroUsd, remainingBudgetMicroUsd and transactions. Total spend is the initial budget minus the remaining budget. Completed calls count only delivered transactions. Rejected attempts remain visible in the log with a zero charge.

Identifiers are session-local sequence numbers such as sim_0001, not blockchain hashes. Timestamps use the browser clock. The interface displays the most recent attempts; the session ledger retains all attempts until reset or navigation away.

Code examples

#

Run a local policy check and inspect the result.

The following standalone JavaScript example can run in a browser console or Node.js. It demonstrates a local decision only; it sends no requests and signs no payments.

JavaScript · runnable local example
const budget = 5_000_000;
const price = 2_000;
const perCallLimit = 20_000;

function simulate(remaining, amount, limit) {
  if (amount > limit) return { status: "policy_denied", remaining };
  if (amount > remaining) return { status: "insufficient_budget", remaining };
  return { status: "delivered", remaining: remaining - amount };
}

console.log(simulate(budget, price, perCallLimit));
// { status: "delivered", remaining: 4998000 }

For the actual frontend implementation, transact(ledger, apiId, policy, createdAt) returns a new ledger and preserves its input. createLedger(amount) validates that a budget is a non-negative safe integer. The unit tests cover exact-budget calls, rejection, repeated spending and invalid configuration.

x402 & interoperability

#

HTTP payment flow and current compatibility status.

x402 is an open payment protocol built around HTTP 402 Payment Required. It describes how a service can communicate payment requirements and how a client can provide payment information before receiving a resource.

The sandbox demonstrates the request → payment terms → authorization → response flow. Its internal state names and JSON are not an implementation of the x402 wire format. No facilitator, verification service, signing flow or settlement network is connected.

Read the official x402 documentation

Explore the x402 specification

Integration requirements

#

Operations and infrastructure needed for a live integration.

OperationResponsibilityRequirements to resolve
Create or update policyDefine agent permissions and spending limitsIdentity, permissions, versioning
Quote a resourceDescribe a price and its validityExpiration, units, quote integrity
Authorize a requestEvaluate the policy and available budgetConcurrency, reservations, idempotency
Record usageAssociate delivery with an authorized requestRetries, duplicate events, reconciliation
Read transactionsInspect authorized, delivered and failed attemptsRetention, access control, pagination

Request and response schemas, authentication, error codes, endpoint paths, webhooks and rate limits require a separate API specification. No public URL is assigned to these operations here. The browser engine's types are not a production API contract.

Errors & recovery

#

A rejected request should be clear, explainable and free of charges.

ResultCauseWhat to do
policy_deniedThe API is disallowed or the price exceeds the ceiling.Choose Successful request or raise the ceiling, then run again.
insufficient_budgetThe remaining budget is less than the request price.Reset the session or choose a larger starting budget.
CanceledReset was selected before delivery.Start a new request. No transaction was recorded.
Clipboard unavailableThe browser denied access to the clipboard.Select and copy the code manually.

The sandbox does not retry requests automatically. Each Run request action is a new local attempt, with one sequence ID and at most one charge. A production system would require durable idempotency keys and server-side concurrency controls; disabling a browser button is not a production guarantee.

Security & data

#

How the sandbox handles input and session data.

  • Demo configuration and history live in memory in the current page. Reset, reload, or leaving the demo clears the session.
  • No wallet addresses, private keys, payment credentials, email addresses or account details are requested.
  • No analytics, cookies, localStorage persistence or waitlist submission are implemented by the application.
  • The page and its assets are served over the network. The hosting platform may process request metadata under its own policies; the payment simulation itself sends no API requests.
  • Documentation search is local. Your search text is not sent to an external search service.

All enforcement here is client-side and can be modified by a browser user. A production service would need server-side policy checks, authenticated actors, key isolation, replay protection, safe retries, audit records and independent security review. The sandbox carries no security certification.

Read our Privacy Policy

Read our Cookie Policy

Availability & FAQ

#

Available features, supported environments and integration enquiries.

QuestionAnswer
Can I make a real payment?No. All balances, charges and responses are simulated.
Do I need an account or wallet?No. Open the demo and run a local request.
Are these the final prices?No. Catalog prices are illustrative values for the simulation.
Which chains or stablecoins are supported?No blockchain or stablecoin network is connected to the sandbox.
Can I integrate the SDK?There is no released aepay SDK or production API.
Can I change the spending limits?Yes. The demo exposes a starting budget and a per-call ceiling.

For integration enquiries, contact support@aepay.vn with your agent workflow, API resources and spending requirements. The available environment is the browser sandbox; production access and launch dates are not announced here.

Return to the demo

End of documentation

You have the full picture. Now follow a request.

Open the demo