Integrate MoltPe in 5 Minutes: The Developer Quickstart
Before You Start
This is the MoltPe developer quickstart. No concept primer, no architecture tour, no vendor comparison. Pick a path, run the snippets in order, and watch a transaction hash land on-chain. The whole thing fits in one coffee.
Here is what you need before the clock starts:
- A MoltPe account. Sign up at moltpe.com/dashboard. It takes about 30 seconds — email, password, verify, done. When you land on the dashboard, open the Developer tab and copy your API key. It starts with
mp_live_for production ormp_test_for testnet. - A language of choice. Node 18+, Python 3.10+, or any shell with
curl. The REST API is the same across all of them. - Optional: an MCP client. If you want Path B, install Claude Desktop, Cursor, or Windsurf. All three support the Model Context Protocol.
Export your key once so every snippet in this post works:
export MOLTPE_API_KEY="mp_test_7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e"
Path A — The REST API Path (Node.js)
The REST path is the most direct. Four HTTP calls, roughly 4 minutes end-to-end. If you only read one section, read this one.
Step 1: Create an agent wallet
This creates an isolated wallet on Polygon Amoy testnet. MoltPe custodies the key, exposes the wallet through an agent ID, and returns the on-chain address.
curl -X POST https://api.moltpe.com/v1/agents/create \
-H "Authorization: Bearer $MOLTPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "research-agent-01",
"network": "polygon-amoy"
}'
Response:
{
"agent_id": "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
"name": "research-agent-01",
"network": "polygon-amoy",
"wallet_address": "0x7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e4d2b6a90",
"status": "active",
"created_at": "2026-04-18T10:22:41Z"
}
Same thing from Node:
// Create an isolated agent wallet on Polygon Amoy testnet.
const res = await fetch("https://api.moltpe.com/v1/agents/create", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "research-agent-01",
network: "polygon-amoy",
}),
});
const agent = await res.json();
console.log(agent.agent_id, agent.wallet_address);
Step 2: Fund the wallet
On testnet, the dashboard has a Fund button that drops test USDC instantly. If you prefer to stay in code, call the fund endpoint. On mainnet, send USDC from your own wallet to wallet_address.
// Top up the testnet wallet with 10 test USDC.
await fetch(`https://api.moltpe.com/v1/agents/${agent.agent_id}/fund`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ amount: "10.00" }),
});
Step 3: Set a spending policy
This is the step that makes a MoltPe wallet different from a raw EOA. The policy is evaluated before every signature, so even a prompt-injected agent cannot blow the cap.
// daily_cap and per_tx_cap are in USDC. allowlist restricts recipients.
await fetch(`https://api.moltpe.com/v1/agents/${agent.agent_id}/policy`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
daily_cap: "5.00",
per_tx_cap: "0.50",
allowlist: [
"0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
"0xA3b5C7e9F1d3B5a7C9e1F3b5A7c9E1f3B5a7C9e1"
]
}),
});
Step 4: Send a test payment
This is the payoff. One call, returns a real on-chain transaction hash.
// Send 0.25 USDC from the agent to a recipient on the allowlist.
const payRes = await fetch("https://api.moltpe.com/v1/payments/send", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
agent_id: agent.agent_id,
amount: "0.25",
recipient: "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
reference: "invoice-1042",
}),
});
console.log(await payRes.json());
Response:
{
"payment_id": "pay_01HKQF9T5XAB3N7V2R6WZKDE8C",
"agent_id": "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
"amount": "0.25",
"token": "USDC",
"network": "polygon-amoy",
"recipient": "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
"tx_hash": "0x7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e4d2b6a90c3e5d7f9a1b3c5d7e9f1a3b5",
"status": "confirmed",
"gas_sponsored": true,
"confirmed_at": "2026-04-18T10:23:04Z"
}
Open the tx hash in a block explorer and you will see a real USDC transfer, gas paid by MoltPe. Total time so far: about 4 minutes. Four HTTP calls, one wallet, one policy, one signed transaction.
Path B — The MCP Path (Claude Desktop, Cursor, Windsurf)
If you want Claude to drive the wallet directly instead of writing code, use the MCP server. You will not write any payment code; you will configure one JSON block and talk to Claude.
Step 1: Configure the MoltPe MCP server
Open your client's MCP config file and add the MoltPe entry. For Claude Desktop, the file lives at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.
{
"mcpServers": {
"moltpe": {
"command": "npx",
"args": ["-y", "@moltpe/mcp-server"],
"env": {
"MOLTPE_API_KEY": "mp_test_7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e"
}
}
}
}
Cursor and Windsurf use the same JSON shape in their MCP settings panels.
Step 2: Restart the client
Fully quit and relaunch Claude Desktop (or Cursor or Windsurf). When it comes back, open the tool picker. You should see these tools listed under moltpe:
create_agent_wallet— create a new isolated walletsend_payment— send USDC to a recipientcheck_balance— read an agent's current USDC balanceset_spending_policy— update daily cap, per-tx cap, and allowlistlist_transactions— audit the agent's on-chain history
Step 3: Ask Claude to create a wallet
Type this into Claude:
"Create a test agent wallet on polygon-amoy called demo-agent and show me the address."
Claude will call create_agent_wallet and reply with something like:
"I created the wallet. Agent ID isag_01HKQFA9P2RBC4V7X3ZJDM5KEWand the address is0xA3b5C7e9F1d3B5a7C9e1F3b5A7c9E1f3B5a7C9e1on polygon-amoy. It has a zero balance right now — fund it from the dashboard or ask me to set a spending policy first."
Step 4: Ask Claude to send a payment
Once funded, try:
"Send 0.10 USDC from demo-agent to 0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2 with reference 'mcp-test'."
Claude calls send_payment and returns the same confirmation payload you saw in Path A, including the transaction hash. Claude itself never sees the private key — MoltPe signs and Claude just reads the result.
Path C — The x402 Path (monetize an API)
Now the other direction: collect payments instead of sending them. This is the x402 protocol — an HTTP endpoint that returns 402 Payment Required until the client pays.
Server: an Express endpoint that charges per request
// Minimal x402 endpoint. Charges 0.01 USDC for each data read.
import express from "express";
import { moltpeX402 } from "@moltpe/x402-express";
const app = express();
app.get(
"/api/premium-data",
moltpeX402({
price: "0.01",
token: "USDC",
network: "polygon",
recipient: "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
apiKey: process.env.MOLTPE_API_KEY,
}),
(req, res) => {
res.json({ data: "premium content only paid callers see" });
}
);
app.listen(3000);
The middleware returns a 402 with MoltPe-formatted payment headers on the first hit and verifies the payment proof on the retry.
Client: catch 402, pay, retry
// Use a MoltPe agent to pay automatically when a server returns 402.
import { createX402Client } from "@moltpe/x402-client";
const client = createX402Client({
apiKey: process.env.MOLTPE_API_KEY,
agentId: "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
maxPaymentUsd: "0.05",
});
const res = await client.fetch("https://api.example.com/api/premium-data");
const data = await res.json();
console.log(data);
// { data: "premium content only paid callers see" }
The client library transparently handles the 402 response, constructs the payment against the agent's spending policy, and retries. Your code sees one call and one JSON response.
Path D — The Python Path
Same four endpoints from Path A, in Python, using httpx.
Create a wallet and set a policy
import os
import httpx
API = "https://api.moltpe.com/v1"
headers = {"Authorization": f"Bearer {os.environ['MOLTPE_API_KEY']}"}
# Create an isolated agent wallet on Polygon Amoy testnet.
agent = httpx.post(
f"{API}/agents/create",
headers=headers,
json={"name": "python-agent-01", "network": "polygon-amoy"},
).json()
# Lock it down: $5/day, $0.50/tx, two approved recipients.
httpx.post(
f"{API}/agents/{agent['agent_id']}/policy",
headers=headers,
json={
"daily_cap": "5.00",
"per_tx_cap": "0.50",
"allowlist": [
"0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
],
},
)
print(agent["agent_id"], agent["wallet_address"])
Send a payment
# Send 0.25 USDC. MoltPe signs, pays gas, returns the tx hash.
payment = httpx.post(
f"{API}/payments/send",
headers=headers,
json={
"agent_id": agent["agent_id"],
"amount": "0.25",
"recipient": "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
"reference": "python-quickstart",
},
).json()
print(payment["tx_hash"], payment["status"])
# 0x7f3a9c2e8b1d4f... confirmed
Troubleshooting
Four things cause 95% of first-run failures. One-line fixes for each.
- Wrong chain. Error
NETWORK_MISMATCHmeans your agent is onpolygon-amoybut you told/payments/sendto usebase. Match them. - Unfunded wallet. Error
INSUFFICIENT_BALANCE. Hit the dashboard Fund button on testnet, or transfer USDC to the wallet address on mainnet. - Policy block. Error
POLICY_VIOLATION: recipient_not_in_allowlistorper_tx_cap_exceeded. Update the policy with a PATCH to/agents/{id}/policyor pick an approved recipient. - Network timeout. Error
RPC_TIMEOUT. The tx was probably still submitted — poll/payments/{payment_id}for final status before retrying, otherwise you will double-spend.
What's Next
You have a live wallet, a policy, and a confirmed transaction. From here the paths diverge depending on what you are building:
- Agent framework integration. Drop the MoltPe SDK into LangChain, CrewAI, or AutoGen with one import. See How to add payments to an AI agent.
- Monetize an API with x402. Expand Path C into a full pay-per-request service. See the x402 complete guide.
- Ship to production. Swap
mp_test_formp_live_, flip the network topolygonorbase, and tighten your policies. Production checklist is in the docs.
Frequently Asked Questions
Do I need to run a blockchain node?
No. MoltPe runs the RPC infrastructure, manages key custody, sponsors gas, and handles confirmations. You interact only with REST endpoints or MCP tool calls. You never touch a node, a JSON-RPC URL, or a private key.
Can I test without real USDC?
Yes. Set the network field to polygon-amoy or base-sepolia when you create the agent and MoltPe provisions a testnet wallet. The dashboard Fund button drops test USDC for free. Spending policies, signatures, and transaction hashes behave exactly as they do on mainnet, so you can fully rehearse your flow before spending a cent.
What if my language is not Node or Python?
The MoltPe REST API is language-agnostic. Any HTTP client that can send JSON over TLS works: Go, Rust, Ruby, PHP, Java, .NET, Swift, or plain curl in a shell script. The examples in this guide show Node, Python, and curl, but the three endpoints (create, policy, send) accept identical JSON payloads regardless of client.
How do I keep my API key secure?
Store the key in an environment variable or a secret manager (AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault, 1Password). Never commit it to git or paste it into client-side code. MoltPe keys are scoped per-environment, so create a separate key for production and rotate it from the dashboard if it leaks. Every key also has an audit log showing exactly which agent signed which transaction.
Create your first agent wallet — 60 seconds
You have the code. All that's left is the key. Sign up, grab an API key, and run the first snippet — you will have a signed transaction hash before the kettle boils.
Create my first agent wallet →About MoltPe
MoltPe is AI-native payment infrastructure that gives AI agents isolated wallets with programmable spending policies for autonomous USDC transactions. Live on Polygon PoS, Base, and Tempo. Supports REST, MCP, and x402.