Fiat on-ramp for AI agent wallets β fund agents with credit card or bank transfer. No crypto needed to get started.
Fund agents with credit card, debit card, or bank transfer
Developer CLI for automation, web widget for user-facing flows
Buy USDC, ETH, SOL across Ethereum, Base, Solana, Polygon
Regulatory-compliant on-ramp β handles identity verification
Generate funding URLs and CLI commands to top up agent wallets from fiat currency.
Check if MoonPay CLI is installed, list managed wallets, and initiate purchases programmatically.
Deploy and fund agents without needing any existing cryptocurrency holdings.
Fund new agent wallets without existing crypto. Credit card to USDC in one step.
mp buy --currency usdc --wallet 0x...
Replenish agent budgets via fiat when funds run low. Triggered by budget policy alerts.
budget alert β MoonPay URL β funded
Fund entire agent fleets via corporate credit card. No crypto treasury required.
fleet.agents.map(a => fundUrl(a.addr))
Quick testnet-to-mainnet transition. Same workflow, real funds.
mp buy β agent funded β deploy
When MOONPAY_SECRET_KEYis configured, the buy widget opens inline in the Aegis dashboard β operators never leave the app. Without it, falls back to opening MoonPay in a new tab.
import { getMoonPayBuyUrl } from "@aegis-ows/integrations";
const url = getMoonPayBuyUrl({
walletAddress: "2G55SdspdgSLcrXm3ZcfSHuDhvuhXtQLWqf1zVbAYCcq",
currencyCode: "sol", // "sol", "usdc", "eth"
baseCurrencyCode: "usd", // Fiat currency
baseCurrencyAmount: "50", // Pre-fill $50
externalTransactionId: "aegis-data-miner-1234",
});
// With secret key: URL is HMAC-signed for embedded iframe mode
// Without: plain URL opens in new tab// POST /api/moonpay/sign
const res = await fetch("/api/moonpay/sign", {
method: "POST",
body: JSON.stringify({
walletAddress: agentId,
currencyCode: "usdc",
externalTransactionId: `aegis-${agentId}-${Date.now()}`,
}),
});
const { url } = await res.json();
// url is ready for iframe src or window.open()Agents that earn more than they spend can cash out to the operator's bank account. The βWithdraw Profitsβ card only appears when an agent has positive P&L.
import { getMoonPaySellUrl } from "@aegis-ows/integrations";
const url = getMoonPaySellUrl({
walletAddress: "2G55Sds...",
currencyCode: "usdc", // Crypto to sell
baseCurrencyCode: "usd", // Fiat to receive
quoteCurrencyAmount: "100", // Amount of crypto to sell
externalTransactionId: "aegis-sell-analyst-5678",
});
// Opens MoonPay sell flow β crypto leaves wallet β fiat hits bankRevenue isn't trapped in crypto
Off-ramping makes agent economies feel like a real business. Operators can withdraw profits to their bank without touching an exchange.
Agent holds SOL but needs to pay in USDC? Swap in-flow via MoonPay β no DEX interaction needed.
import { getMoonPaySwapUrl } from "@aegis-ows/integrations";
const url = getMoonPaySwapUrl({
walletAddress: "2G55Sds...",
fromCurrencyCode: "sol",
toCurrencyCode: "usdc",
});
// Opens MoonPay swap widgetTrack buy/sell/swap transactions in real-time. Requires MOONPAY_SECRET_KEY.
import { getMoonPayTransaction } from "@aegis-ows/integrations";
const tx = await getMoonPayTransaction("aegis-data-miner-1234");
// Returns:
// {
// id: "tx_abc...",
// status: "completed", // waitingPayment | pending | completed | failed
// cryptoAmount: "0.5",
// baseCurrencyAmount: "50",
// baseCurrency: "usd",
// currency: "sol",
// walletAddress: "2G55Sds...",
// createdAt: "2024-01-15T10:30:00Z"
// }// GET /api/moonpay/transactions?externalId=aegis-data-miner-1234
// Returns MoonPayTransaction object
// Status polling: dashboard component polls every 10s until terminal stateMoonPay sends real-time webhook events when transactions complete. Aegis validates the signature and logs to the agent activity feed.
// POST /api/moonpay/webhook
// Headers: moonpay-signature-v2: <HMAC-SHA256 signature>
// Events handled:
// transaction_completed β log success, trigger balance refresh
// transaction_failed β log failure, notify operator
// transaction_updated β log status change
// Signature validated using MOONPAY_WEBHOOK_KEY
// Invalid signatures return 401import { validateMoonPayWebhook } from "@aegis-ows/integrations";
const payload = validateMoonPayWebhook(rawBody, signatureHeader);
if (!payload) {
// Invalid signature β reject
}
// payload.type: "transaction_completed" | "transaction_failed" | ...
// payload.data: transaction detailsDynamically query which tokens MoonPay supports instead of hardcoding. Cached for 1 hour.
import { getMoonPayCurrencies } from "@aegis-ows/integrations";
const currencies = await getMoonPayCurrencies();
// With API key: fetches from MoonPay /v3/currencies
// Without: returns hardcoded [SOL, USDC, ETH]
// Each currency:
// { code: "sol", name: "Solana", minBuyAmount: 0.1, maxBuyAmount: 30000,
// isSellSupported: true, ... }Check if MoonPay is available in the operator's country before showing funding options.
import { checkMoonPayAvailability } from "@aegis-ows/integrations";
const availability = await checkMoonPayAvailability();
// { isAllowed: true, isBuyAllowed: true, isSellAllowed: true, alpha2: "US" }
// Without API key: returns optimistic default (always allowed)
// With API key: checks MoonPay /v4/ip_address endpointimport { getMoonPayFundingOptions } from "@aegis-ows/integrations";
const options = getMoonPayFundingOptions("0x1234...");
// Returns:
// {
// provider: "moonpay",
// command: "mp buy --currency usdc --wallet 0x1234...",
// url: "https://www.moonpay.com/buy/usdc?walletAddress=0x1234...",
// supportedTokens: ["USDC", "ETH", "SOL"],
// supportedChains: ["Ethereum", "Base", "Solana", "Polygon"]
// }Returns both a CLI command and a web URL. Use the CLI for automation, or open the URL in a browser for a guided purchase flow.
# Check if MoonPay CLI is installed
mp --version
# Buy USDC for an agent wallet
mp buy --currency usdc --wallet 0x1234...
# List managed wallets
mp wallet list --jsonimport { isMoonPayInstalled, getMoonPayWallets } from "@aegis-ows/integrations";
// Check CLI availability
if (isMoonPayInstalled()) {
// List all wallets managed by MoonPay CLI
const wallets = getMoonPayWallets();
console.log("Managed wallets:", wallets);
// ["0x1234...", "0x5678...", ...]
}const agentWallet = "0x1234...";
const fundingUrl = `https://www.moonpay.com/buy/usdc?walletAddress=${agentWallet}`;
// Open in browser for guided purchase flow
// MoonPay handles KYC, payment processing, and crypto deliveryNo API key for URLs
The web widget URL works without authentication. MoonPay handles the full purchase flow including identity verification, payment processing, and delivery to the agent wallet.
Budget policy alerts when agent balance drops below threshold.
getMoonPayFundingOptions() returns a purchase URL for the agent wallet.
Credit card, debit card, or bank transfer through MoonPay checkout.
USDC, ETH, or SOL delivered directly to the agent wallet address.
Agent detects new balance and resumes API purchases and service delivery.
# Publishable key β enables embedded widget + currencies API
MOONPAY_API_KEY=pk_live_...
# Secret key β enables URL signing + transaction status queries
MOONPAY_SECRET_KEY=sk_live_...
# Webhook key β enables real-time transaction notifications
MOONPAY_WEBHOOK_KEY=whk_...Graceful degradation
Everything works without API keys (external URLs). Each key unlocks more features. Same pattern as Zerion and Allium.
| Feature | Requires |
|---|---|
| Buy/Sell/Swap URLs | Nothing (works out of the box) |
| Embedded widget (iframe) | MOONPAY_SECRET_KEY |
| Currencies API | MOONPAY_API_KEY |
| Geo availability check | MOONPAY_API_KEY |
| Transaction status | MOONPAY_SECRET_KEY |
| Webhooks | MOONPAY_WEBHOOK_KEY |
| CLI purchases | @moonpay/cli |
UX Track
Seamless fiat-to-agent funding flow β deploy and fund agents with a credit card
Onboarding
Zero-crypto-knowledge agent deployment β no MetaMask, no seed phrases for operators
Enterprise
Corporate card funding for agent fleets with expense tracking and receipts
Payments
Hybrid fiat/crypto agent economies β agents earn crypto, operators fund with fiat
| Function | Parameters | Returns |
|---|---|---|
| getMoonPayBuyUrl | options | string (signed URL) |
| getMoonPaySellUrl | options | string (signed URL) |
| getMoonPaySwapUrl | options | string |
| getMoonPayTransaction | externalId | MoonPayTransaction | null |
| getMoonPayCurrencies | (none) | MoonPayCurrency[] |
| checkMoonPayAvailability | ipAddress? | MoonPayAvailability |
| validateMoonPayWebhook | rawBody, signature | payload | null |
| signMoonPayUrl | url | string | null |
| getMoonPayConfig | (none) | config object |
| getMoonPayFundingOptions | walletAddress | FundingOption |