AI Commerce
Every GullyPay merchant is automatically agent-native. GullyPay publishes a merchant.ai.json config — generated from the merchant's real stores and products — so AI agents can discover merchants, search their catalog, and open checkout sessions without ever loading a website.
All AI Commerce endpoints live under the /ai base path on the GullyPay API.
How It Works
Endpoints
/ai/merchantsList AI-discoverable (active) merchants — public/ai/merchants/:merchantId/configGet the merchant.ai.json config (generated on first read) — public/ai/merchants/:merchantId/config/generateRegenerate the config from live stores & products — requires merchant JWT/ai/searchAgent product search across active products — public/ai/sessionsOpen an AI checkout session for an agent — requires a scoped API keyThe discovery reads (GET /ai/merchants, GET /ai/merchants/:id/config, GET /ai/search) are public so autonomous agents can discover and browse without a platform login. Regenerating a merchant's config is a state-changing write, so POST /ai/merchants/:merchantId/config/generate requires the merchant's JWT (the dashboard "Regenerate config" button sends it automatically). POST /ai/sessions is machine-facing and requires a scoped API key (Authorization: Bearer rk_…), the same credential the x402 SDKs send.
GET /ai/merchants
Returns the merchants that are active and therefore discoverable by agents.
GET /ai/merchants/:merchantId/config
Returns the persisted merchant_ai_configs row for the merchant. If no config exists yet, one is generated from the merchant's live catalog and returned.
merchant.ai.json schema
The config object is the merchant.ai.json document. Its fields are built directly from the merchant's real records — no data is fabricated.
| Field | Type | Description |
|---|---|---|
merchant | object | { id, name, slug } of the merchant |
stores | array | One entry per store: { id, name, currency } |
products | array | One entry per product in the first store: { id, title, type, status } |
capabilities | string[] | Agent actions this merchant supports: search, purchase, refund |
version | string | Config schema version (currently 1.0) |
POST /ai/merchants/:merchantId/config/generate
Rebuilds the merchant.ai.json from the merchant's current stores and products and persists a new row. Call this after adding, editing, or archiving products so agents see an up-to-date catalog. Returns the same shape as GET .../config.
The config is a snapshot, not a live view. Regenerate it whenever your catalog changes — the merchant dashboard exposes a Regenerate config button that calls this endpoint.
GET /ai/search
Agent-facing product search. Matches the query (case-insensitive substring) against the titles of active products across the platform.
| Query param | Type | Required | Description |
|---|---|---|---|
q | string | No | Search term; empty returns all active products |
price is an integer in the store currency's smallest unit (e.g. cents). 1800 = $18.00.
POST /ai/sessions
Opens an AI checkout session for an agent against a merchant. The session expires 30 minutes after creation.
| Field | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Identifier of the agent opening the session |
merchantId | string | Yes | Merchant the session targets |
Example: an agent buying flow
Next Steps
- x402 Protocol -- Let agents pay per request
- Checkout -- Complete the purchase
- Payments -- Capture and settle funds