x402 EUR settlement for Vercel eve agents
asterpay-agent template into any eve project and your agent can pay and get paid in real euros.
Why this exists
eve is Vercel's filesystem-first framework for building AI agents. Every agent built on it that pays for a service needs a payment rail — and the merchant on the other side usually wants euros in a bank account, not stablecoins on a chain. AsterPay is the layer that closes that gap: it settles USDC/EURC to EUR via SEPA Instant, and it is the only one that scores the counterparty's trust before money moves.
What the template adds
| Surface | File | What it does |
|---|---|---|
| Connection (read-only) | connections/asterpay.ts | AsterPay's hosted MCP tools (trust check, settlement estimate, merchant resolve, market rates). No API key. The model never sees a URL or credential. |
| KYA tool | tools/asterpay_kya.ts | Free 0-100 trust score for any wallet / ERC-8004 id. The differentiator. |
| Quote tool | tools/asterpay_quote.ts | Free USDC→EUR settlement estimate, with the fee. |
| Pay tool | tools/asterpay_pay.ts | x402 payment in USDC, gated by human approval above a USDC ceiling. Counterparty settles to EUR. |
| Skill | skills/eur-settlement.md | Playbook: when to KYA, thresholds, fee math. |
The connection — read-only AsterPay tools, no API key
One file exposes AsterPay's hosted MCP tools to the model. eve brokers auth; the model only discovers tools via connection_search and never sees a URL or credential.
// agent/connections/asterpay.ts
import { defineMcpClientConnection } from "eve/connections";
export default defineMcpClientConnection({
url: process.env.ASTERPAY_MCP_URL ?? "https://mcp-api.asterpay.io/mcp",
description:
"AsterPay: trust, discovery and EUR-settlement layer for AI agent commerce. " +
"Read-only KYA trust score, USDC-to-EUR estimate, merchant resolve, market rates.",
tools: { allow: ["check_agent_trust", "settlement_estimate", "merchant_resolve", "market_rates"] },
});
The KYA tool — check trust before paying
// agent/tools/asterpay_kya.ts
import { defineTool } from "eve/tools";
import { z } from "zod";
const API = process.env.ASTERPAY_API_URL ?? "https://x402.asterpay.io";
export default defineTool({
description: "Look up an agent/wallet KYA Trust Score (0-100) before transacting. Free, read-only.",
inputSchema: z.object({ address: z.string().min(1) }),
async execute({ address }) {
const res = await fetch(`${API}/v1/agent/trust-score/${encodeURIComponent(address)}`,
{ headers: { accept: "application/json" } });
if (!res.ok) return { ok: false, status: res.status };
return { ok: true, ...(await res.json()) };
},
});
The pay tool — x402 in USDC, EUR out, approval-gated
Money movement is authored as a native tool so it can sit behind eve's approval gate. Note: the property is approval (with helpers once()/always()/never() or a policy), not needsApproval.
// agent/tools/asterpay_pay.ts
import { defineTool } from "eve/tools";
import { z } from "zod";
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const MAX_AUTO_USDC = Number(process.env.ASTERPAY_MAX_AUTO_USDC ?? "50");
export default defineTool({
description: "Pay an x402 resource in USDC; counterparty settles in EUR via SEPA Instant.",
inputSchema: z.object({
url: z.string().url(),
maxUsdc: z.number().positive(),
settleEurTo: z.string().optional(),
}),
approval: ({ toolInput }) =>
(toolInput?.maxUsdc ?? 0) > MAX_AUTO_USDC ? "user-approval" : "not-applicable",
async execute({ url }) {
const signer = privateKeyToAccount(process.env.ASTERPAY_AGENT_PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
registerExactEvmScheme(client, { signer });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch(url);
return { ok: res.ok, status: res.status, paymentResponse: res.headers.get("x-payment-response") };
},
});
Install
Clone the open-source template (github.com/petteri74dev/asterpay-agent, MIT):
git clone https://github.com/petteri74dev/asterpay-agent
cd asterpay-agent
cp .env.example .env # set ASTERPAY_AGENT_PRIVATE_KEY
npm install
npm run dev
Or drop the connections/, tools/ and skills/ files into an existing eve project (npx eve@latest init my-agent).
Security model
AsterPay is non-custodial: the agent signs its own USDC payments, and EUR settlement runs through a licensed EU partner — AsterPay never holds the funds. The signing key lives only inside the eve tool's execute sandbox as an encrypted env var, never in instructions.md and never in model context. For production, use a session key or smart account with an on-chain spend cap and keep the approval gate on.
Pricing
- Read-only (KYA, quote, discovery): free, no signup.
- EUR settlement: 0.5% of the settled amount (plus the partner spread shown in the quote).
- x402 API calls: $0.001-0.10 per call, paid in USDC.
Try a KYA trust score right now
No signup, no key. Read-only and live in production.
Open a live trust score →