A modern WooCommerce payment gateway for ForgingBlock API focused on conversions, cleaner payment UX, and AI-agent compatibility.
This plugin is optimized for both:
- Human checkout (direct customer payment in WooCommerce)
- AI-agent checkout (programmatic resolve/verify flows)
It uses ForgingBlock Orders API and now redirects customers to invoice_url (single-use invoice) instead of checkout_url.
- During checkout, this plugin redirects to
invoice_url.
POST /api/v1/ordersorder creation (Bearer authentication)GET /api/v1/orders/{orderId}status sync on thank-you page (Bearer authentication)- Callback endpoint support:
?wc-api=wc_gateway_forgingblock - Status mapping support:
newpartially_paidcompletedexpired
GET /wp-json/forgingblock/v1/agent/resolve?id=<checkoutId>GET /wp-json/forgingblock/v1/agent/resolve?url=<checkoutOrInvoiceUrl>GET /wp-json/forgingblock/v1/agent/verify/<invoiceId>POST /wp-json/forgingblock/v1/agent/checkoutPOST /wp-json/forgingblock/v1/agent/create-orderGET /wp-json/forgingblock/v1/agent/productsGET /wp-json/forgingblock/v1/agent/products/{id}
GET /wp-json/forgingblock/v1/agent/resolveNormalize checkout or invoice into agent-friendly format.
Supports:
id=<checkoutId>url=<checkoutOrInvoiceUrl>
Returns:
- invoice_id
- invoice_url
- payment routes
- recommended_tx (if available)
GET /wp-json/forgingblock/v1/agent/products?q=search&page=1
GET /wp-json/forgingblock/v1/agent/products/{id}Used for:
- catalog browsing
- agent-side filtering
- product selection
POST /wp-json/forgingblock/v1/agent/create-order{
"product_id": 123,
"quantity": 1
}Creates a WooCommerce order and returns:
- order_id
- order_key
- total
- currency
POST /wp-json/forgingblock/v1/agent/checkout{
"order_id": 987,
"order_key": "wc_order_xxx"
}Converts Woo order → ForgingBlock invoice.
Returns:
- invoice_url
- remote_order_id
- status
- totals
Access model:
- allowed for logged-in users
- OR guests with valid
order_id + order_key - otherwise returns 401
GET /wp-json/forgingblock/v1/agent/verify/{invoiceId}Returns payment state:
new → partially_paid → completed → expired
products / resolve / verify → public (read-only)
create-order → public
checkout → requires order_key OR logged-in user
Install from a ZIP file (recommended)
-
In WordPress Admin, go to Plugins → Add New Plugin → Upload Plugin.
-
Choose the plugin ZIP.
-
Click Install Now and then Activate.
-
Go to WooCommerce → Settings → Payments → ForgingBlock CommerceFlow.
-
Turn it on and paste your ForgingBlock API key (Dashboard → Account Settings → Integrations → API Token).
-
Save.
-
(Recommended) Configure Callback URL for instant order updates:
Copy the Callback URL from plugin settings and paste it into:
(Dashboard → Account Settings → Integrations → Callback URL)
This ensures real-time payment updates (important for AI agents).
-
(Recommended) Set your Business Name for better checkout experience:
Go to:
(Dashboard → Account Settings → Business Details)
This name is shown in the payment form and used in the "Return to your store" button after checkout.
-
(Recommended) Validate Thank You page is configured correctly:
In WooCommerce, the Thank You page is not a separate page you create manually. It is automatically shown after checkout and is based on your Checkout page.
To make sure it works correctly:
Go to:
WooCommerce → Settings → Advanced
Make sure:
- ✔ A Checkout page is assigned
- ✔ The page exists and is published
- ✔ The page contains the WooCommerce Checkout block or
[woocommerce_checkout]
If all three are configured correctly, your Thank You page will function properly.
For detailed pages setup and customization, see the WooCommerce official guide:
https://woocommerce.com/document/woocommerce-pages/
- Shopper chooses ForgingBlock Pay at checkout.
- WooCommerce creates order via ForgingBlock.
- Redirect to invoice_url.
- Shopper pays.
- Store updates via callback or polling.
https://YOUR_STORE_DOMAIN/?wc-api=wc_gateway_forgingblock
Use:
https://github.com/forgingblock/forgingblock-agentkit
AI Agent (AgentKit)
│
▼
Next.js Agent API (/api/agent)
│
├───────────────┬──────────────────────────────┐
▼ ▼ ▼
Woo Plugin ForgingBlock API Wallet Provider
(agent routes) │ │
│ ▼ ▼
│ invoice_url ERC20 transfer
│ │ │
▼ ▼ ▼
Woo Order → Checkout → Payment → Verify → Completed
order_id
order_key
Via:
- Woo REST API
- Woo MCP tools
- existing checkout
POST /wp-json/forgingblock/v1/agent/checkout
{
"order_id": 987,
"order_key": "wc_order_xxx"
}Response includes:
invoice_urlremote_order_idredirect_url
invoice_url → create_payment → recommended_tx
ERC20ActionProvider_transfer
GET /wp-json/forgingblock/v1/agent/verify/{invoiceId}
search → Woo APIs
checkout → /agent/checkout
payment → create_payment
execute → wallet
verify → /agent/verify
This plugin uses a layered security model designed for both human users and AI agents.
Public (no auth)
│
▼
Read-only endpoints
(products, resolve, verify)
│
▼
Capability-based access
(order_id + order_key)
│
▼
Checkout (invoice creation)
│
▼
Server-side API (ForgingBlock)
│
▼
Blockchain payment
| Endpoint | Access |
|---|---|
/agent/products |
Public |
/agent/products/{id} |
Public |
/agent/resolve |
Public |
/agent/verify/{invoiceId} |
Public |
/agent/create-order |
Public |
/agent/checkout |
Requires order_id + order_key OR logged-in user |
Checkout does not require full authentication.
Instead it uses:
order_id + order_key
This acts as a capability token:
- grants access to a specific order
- cannot be used to access other orders
- safe to expose to AI agents
Agents can:
- create order
- checkout
- pay
without needing:
❌ WordPress login
❌ API keys
❌ cookies
- ForgingBlock API key is never exposed
- all sensitive calls happen server-side
Safe because they:
- do not mutate state
- only return payment / catalog data
Agent
│
├── public endpoints (safe)
│
├── checkout (requires order_key)
│
▼
Woo Plugin (trusted boundary)
│
▼
ForgingBlock API (secret key)
│
▼
Blockchain
Public read → Capability write → Server execution → Blockchain
---
## Optional MCP Integration
* [https://github.com/WordPress/mcp-adapter](https://github.com/WordPress/mcp-adapter)
* [https://developer.woocommerce.com/docs/features/mcp/](https://developer.woocommerce.com/docs/features/mcp/)
---
## Minimal Agent Example
```ts
const checkout = await fetch('/agent/checkout', {...})
const payment = await create_payment(checkout.invoice_url)
await ERC20ActionProvider_transfer(payment)
await fetch(`/agent/verify/${payment.invoiceId}`)
Woo order → agent/checkout → invoice_url
→ AgentKit → create_payment
→ wallet → transfer
→ agent/verify → completed

