ForgingBlock AI payment agent example using AgentKit and Privy wallets to create and pay crypto invoices, search and buy from WooCommerce
forgingblock-agentkit is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on agent, agentkit, ai, cryptocurrency. It currently has 0 GitHub stars and 0 forks, and sits alongside related tools like x402-deploy, helix, aser.
This repository demonstrates how to build an AI-powered crypto payment agent using:
The agent can:
This project is a reference implementation showing how AI agents can interact with:




Clone the repository:
git clone https://github.com/forgingblock/forgingblock-agentkit.git
cd forgingblock-agentkit
Install dependencies:
npm install
Create a .env file in the project root.
Example:
OPENAI_API_KEY=
PRIVY_APP_ID=
PRIVY_APP_SECRET=
FB_API_KEY=
NETWORK_ID=base-mainnet
API key used for the AI model.
Credentials for Privy embedded wallets.
You could create in Privy dashboard:
Merchant API key used to create orders.
Create an API key in the dashboard:
Dashboard → Account Settings → Integrations → API Token
If this variable is not defined, the agent can still perform payments but cannot create orders.
Network used by the wallet provider.
Example:
NETWORK_ID=base-mainnet
Start the development server:
npm run dev
Open the application:
http://localhost:3000
User / AI Agent
│
▼
Next.js Agent API (/api/agent)
│
├───────────────┬────────────────────────┬──────────────────────┐
▼ ▼ ▼ ▼
Woo Tools Payment Tools Wallet Execution LLM Reasoning
│ │ │ │
▼ ▼ ▼ ▼
Woo REST API ForgingBlock API ERC20 Transfer Local Filtering
│ │ │ │
▼ ▼ ▼ ▼
Woo Store Invoice + Routes Blockchain Tx Ranked Results
User Input
│
├── WooCommerce URL ───────────────┐
│ ▼
│ woo_prepare_checkout
│ │
│ ▼
│ create_payment
│ │
│ ▼
│ Store Payment State
│ │
│ ▼
│ Execute / Confirm
│
├── Simple Search ────────────────┐
│ ▼
│ woo_search_products
│
└── Advanced Query ───────────────┐
▼
Fetch catalog
│
▼
Local filtering (JS / LLM)
All endpoints are exposed via WordPress REST:
/wp-json/forgingblock/v1/agent/*
GET /wp-json/forgingblock/v1/agent/products
GET /wp-json/forgingblock/v1/agent/products?q=search&page=1
GET /wp-json/forgingblock/v1/agent/products/{id}
POST /wp-json/forgingblock/v1/agent/create-order
{
"product_id": 123,
"quantity": 1
}
POST /wp-json/forgingblock/v1/agent/checkout
{
"order_id": 123,
"order_key": "wc_order_xxx"
}
Example tool definitions for agent integration:
{
"name": "woo_search_products",
"description": "Search WooCommerce products",
"parameters": {
"type": "object",
"properties": {
"base": { "type": "string" },
"query": { "type": "string" },
"page": { "type": "number" }
},
"required": ["base"]
}
}
{
"name": "woo_prepare_checkout",
"description": "Prepare WooCommerce checkout",
"parameters": {
"type": "object",
"properties": {
"base": { "type": "string" },
"url": { "type": "string" },
"product_id": { "type": "number" },
"quantity": { "type": "number" }
}
}
}
{
"name": "create_payment",
"description": "Generate payment details",
"parameters": {
"type": "object",
"properties": {
"invoice_url": { "type": "string" }
},
"required": ["invoice_url"]
}
}
If user intent is:
find / search / browse / list
→ MUST call:
woo_search_products
Only call:
woo_prepare_checkout
when:
If user asks:
cheaper than
under price
best / cheapest
→ DO NOT rely on Woo API
→ Fetch catalog and filter locally
Always:
create_payment → confirm → transfer → verify
create_payment → confirm → ERC20 transfer → verify_payment
ERC20ActionProvider_transfer
find mugs
→ list products
→ select product
→ checkout
→ confirm
→ pay
→ verify
In-memory. Use Redis in production.
This repository is an example implementation demonstrating how AI agents can integrate with the ForgingBlock payment infrastructure.
It is intended for experimentation and developer reference.
Production deployments should include additional security, validation, and persistence layers.
A payments protocol for the internet. Built on HTTP.
Daydreams is a set of tools for building agents for commerce
The best way to monetize AI applications & MCP, using x402, CDP Smart Wallets & Paymaster
URL shortener
AWS payment demo of x402 using Bedrock AgentCore, Strands SDK, and CloudFront.
Cloudera CDP SDK for Java