Skip to content

Payments API ​

Manage transactions, payment methods, notifications, x402 resources, and Stripe integrations.

Endpoints ​

MethodEndpointDescription
GET/api/agents/{id}/transactionsList transactions
GET/api/agents/{id}/payment-methodsList payment methods
POST/api/agents/{id}/payment-methodsCreate payment method
GET/api/agents/{id}/payment-notificationsList payment notifications
POST/api/agents/{id}/x402-resourcesCreate x402 resource
GET/api/agents/{id}/x402-resourcesList x402 resources
DELETE/api/agents/{id}/x402-resources/{resourceId}Delete x402 resource
POST/api/agents/{id}/stripe/checkoutCreate checkout session
POST/api/agents/{id}/stripe/chargeCharge an issuing card
GET/api/agents/{id}/stripe/cardsList issuing cards
POST/api/agents/{id}/stripe/webhookStripe webhook endpoint

Transactions ​

List Transactions ​

bash
GET /api/agents/{id}/transactions

Query Parameters ​

ParameterTypeDescription
typestringFilter by type: inbound, outbound, x402
currencystringFilter by currency
limitnumberMax results (default: 50)
offsetnumberPagination offset

Response ​

json
{
  "transactions": [
    {
      "id": "txn_abc123",
      "type": "inbound",
      "amount": "25.00",
      "currency": "USD",
      "from": "John Doe",
      "to": "Agent Wallet",
      "reference": "REF123456",
      "source": "bank_notification",
      "created_at": "2026-03-11T10:00:00Z"
    }
  ],
  "total": 142
}

Payment Methods ​

List Payment Methods ​

bash
GET /api/agents/{id}/payment-methods

Response ​

json
{
  "methods": [
    {
      "id": "pm_123",
      "type": "wallet",
      "label": "USDC Wallet",
      "details": {
        "address": "0x1234...abcd",
        "network": "base"
      },
      "created_at": "2026-03-01T00:00:00Z"
    }
  ]
}

Create Payment Method ​

bash
POST /api/agents/{id}/payment-methods
Content-Type: application/json

Request Body ​

json
{
  "type": "wallet",
  "label": "USDC Wallet",
  "details": {
    "address": "0x1234...abcd",
    "network": "base"
  }
}

Response ​

json
{
  "id": "pm_456",
  "type": "wallet",
  "label": "USDC Wallet",
  "details": {
    "address": "0x1234...abcd",
    "network": "base"
  },
  "created_at": "2026-03-11T12:00:00Z"
}

Payment Notifications ​

List Payment Notifications ​

bash
GET /api/agents/{id}/payment-notifications

Query Parameters ​

ParameterTypeDescription
statusstringFilter: matched, unmatched
limitnumberMax results (default: 50)

Response ​

json
{
  "notifications": [
    {
      "id": "pn_789",
      "gateway": "telegram",
      "message": "You received $25.00 from John Doe. Ref: REF123456",
      "status": "matched",
      "transaction_id": "txn_abc123",
      "parsed": {
        "amount": "25.00",
        "currency": "USD",
        "from": "John Doe",
        "reference": "REF123456"
      },
      "created_at": "2026-03-11T10:00:00Z"
    }
  ]
}

x402 Resources ​

Create x402 Resource ​

bash
POST /api/agents/{id}/x402-resources
Content-Type: application/json

Request Body ​

json
{
  "path": "/rpc/premium-analysis",
  "price": "0.01",
  "currency": "USDC",
  "network": "base",
  "description": "Premium market analysis"
}

Response ​

json
{
  "id": "x402_123",
  "path": "/rpc/premium-analysis",
  "price": "0.01",
  "currency": "USDC",
  "network": "base",
  "description": "Premium market analysis",
  "created_at": "2026-03-11T12:00:00Z"
}

List x402 Resources ​

bash
GET /api/agents/{id}/x402-resources

Response ​

json
{
  "resources": [
    {
      "id": "x402_123",
      "path": "/rpc/premium-analysis",
      "price": "0.01",
      "currency": "USDC",
      "network": "base",
      "description": "Premium market analysis",
      "created_at": "2026-03-11T12:00:00Z"
    }
  ]
}

Delete x402 Resource ​

bash
DELETE /api/agents/{id}/x402-resources/{resourceId}

Response ​

json
{
  "success": true
}

Stripe ​

Create Checkout Session ​

bash
POST /api/agents/{id}/stripe/checkout
Content-Type: application/json

Request Body ​

json
{
  "amount": 2000,
  "currency": "usd",
  "description": "Pro Plan",
  "success_url": "https://example.com/success",
  "cancel_url": "https://example.com/cancel"
}

Response ​

json
{
  "session_id": "cs_abc123",
  "url": "https://checkout.stripe.com/pay/cs_abc123",
  "status": "open"
}

Charge Issuing Card ​

bash
POST /api/agents/{id}/stripe/charge
Content-Type: application/json

Request Body ​

json
{
  "card_id": "ic_abc123",
  "amount": 500,
  "currency": "usd",
  "description": "API subscription"
}

Response ​

json
{
  "charge_id": "ch_abc123",
  "amount": 500,
  "currency": "usd",
  "status": "succeeded"
}

List Issuing Cards ​

bash
GET /api/agents/{id}/stripe/cards

Response ​

json
{
  "cards": [
    {
      "id": "ic_abc123",
      "last4": "4242",
      "brand": "Visa",
      "status": "active",
      "spending_limit": 10000,
      "created_at": "2026-03-01T00:00:00Z"
    }
  ]
}

Stripe Webhook ​

bash
POST /api/agents/{id}/stripe/webhook
Stripe-Signature: t=...,v1=...

This endpoint is called by Stripe. Configure it in the Stripe Dashboard.

Processed events:

EventAction
checkout.session.completedLogs transaction, marks session complete
issuing_authorization.requestApproves or declines per agent settings
charge.succeededLogs completed charge

Signatures are verified using HMAC-SHA256 with the configured webhook secret.


Error Codes ​

CodeDescription
400Invalid request body or missing required fields
401Authentication required
402Payment required (x402 gated endpoint)
404Resource not found
409Duplicate payment method or resource
422Stripe API error (details in response body)
500Internal server error

Error response format:

json
{
  "error": "Invalid amount",
  "code": 400
}