Skip to content

Payments

The payments system provides transaction tracking, automatic bank notification detection, x402 micropayments, and Stripe card payments.

Overview

Payments in Uranus consists of four components:

  • Transaction Tracking — Record and query payments with balance tracking
  • Bank Notification Detection — Automatically parse bank SMS/email into transactions
  • x402 Micropayments — Gate API endpoints behind HTTP 402 paywalls
  • Stripe Payments — Checkout sessions, virtual issuing cards, and charge management

Transaction Tracking

LLM Tools

The agent has access to five payment tools:

ToolDescription
check_balanceQuery current wallet balance
list_transactionsList transactions with optional filters
log_paymentManually record a payment
send_paymentInitiate an outbound payment
list_payment_methodsList configured payment methods

Payment Methods

Payment methods are stored per agent and can be managed via the dashboard or API. Each method includes:

  • Type — Card, bank account, wallet, etc.
  • Label — User-friendly name
  • Details — Method-specific configuration
bash
curl -X POST https://your-domain.com/api/agents/{id}/payment-methods \
  -H "Content-Type: application/json" \
  -d '{
    "type": "wallet",
    "label": "USDC Wallet",
    "details": {
      "address": "0x...",
      "network": "base"
    }
  }'

Bank Notification Auto-Detection

The system intercepts incoming gateway messages (SMS, email, WhatsApp) and checks for bank payment notifications before they reach the LLM.

How It Works

  1. Keyword matching — Messages are scanned against a set of financial keywords (e.g., "credited", "debited", "transfer", "balance"). A minimum of 2 keyword matches triggers detection.
  2. LLM parsing — Matched messages are sent to Workers AI for structured extraction of amount, currency, sender/receiver, reference number, and date.
  3. Transaction creation — Parsed data is automatically saved to the transactions table with the source gateway and original message linked.
┌──────────────┐     ┌───────────────────┐     ┌──────────────┐
│   Gateway    │────▶│ Keyword Detection  │────▶│  Workers AI  │
│  (SMS/Email) │     │  (2+ matches)      │     │  (LLM Parse) │
└──────────────┘     └───────────────────┘     └──────┬───────┘


                                               ┌──────────────┐
                                               │ transactions │
                                               │    table     │
                                               └──────────────┘

Detected notifications are also stored in the payment_notifications table with a matched or unmatched status indicating whether they were successfully parsed.

x402 Micropayments

x402 implements the x402.org protocol for HTTP 402-based micropayments.

Gated Endpoints

Create resources that require payment before access:

bash
curl -X POST https://your-domain.com/api/agents/{id}/x402-resources \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/rpc/premium-analysis",
    "price": "0.01",
    "currency": "USDC",
    "network": "base",
    "description": "Premium market analysis"
  }'

How It Works

  1. A client calls a gated /rpc endpoint
  2. The checkX402PaymentGate middleware intercepts the request
  3. If no payment is attached, the server returns HTTP 402 with payment requirements:
json
{
  "x402Version": 1,
  "accepts": [{
    "scheme": "exact",
    "network": "base",
    "maxAmountRequired": "10000",
    "resource": "https://your-domain.com/api/agents/{id}/rpc/premium-analysis",
    "description": "Premium market analysis",
    "payTo": "0x..."
  }]
}
  1. The client submits payment and retries with a payment proof header
  2. The middleware verifies payment via the Coinbase facilitator and allows the request through
  3. A transaction is logged with type x402

Supported Networks

NetworkCurrency
BaseUSDC
AvalancheUSDC
SolanaUSDC

Stripe Integration

Checkout Sessions

Create hosted checkout pages for one-time or subscription payments:

bash
curl -X POST https://your-domain.com/api/agents/{id}/stripe/checkout \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2000,
    "currency": "usd",
    "description": "Pro Plan",
    "success_url": "https://example.com/success",
    "cancel_url": "https://example.com/cancel"
  }'

Issuing Virtual Cards

Create and manage Stripe Issuing virtual cards for agent spending:

  • Create cards with spending limits
  • Freeze/unfreeze cards on demand
  • Track authorizations in real time

LLM Tools

ToolDescriptionRequires Approval
create_checkoutCreate a Stripe checkout sessionYes
charge_cardCharge a virtual issuing cardYes

Approval Threshold

Configure requireApprovalAbove in payment settings to allow the agent to autonomously charge amounts below the threshold. Charges above the threshold require human approval via the Human-in-the-Loop system.

Webhook Processing

Set your Stripe webhook endpoint to:

https://your-domain.com/api/agents/{id}/stripe/webhook

Processed events:

EventAction
checkout.session.completedLogs transaction, updates session status
issuing_authorization.requestApproves or declines based on settings
charge.succeededLogs completed charge transaction

Webhook signatures are verified using HMAC-SHA256 with your Stripe webhook secret.

Payment Settings

Configure payments under Settings > Payments:

SettingDescription
walletAddressDefault crypto wallet address
walletNetworkDefault blockchain network
defaultCurrencyDefault currency for transactions
stripeSecretKeyStripe API secret key
stripePublishableKeyStripe publishable key
stripeWebhookSecretStripe webhook signing secret
x402.enabledEnable x402 micropayments
x402.facilitatorUrlCoinbase facilitator endpoint
requireApprovalAboveAuto-approve charges below this amount

Dashboard

Navigate to Payments in the sidebar to access the payments UI. The page has six tabs:

  1. Transactions — View and filter all transactions
  2. Balance — Current balance summary
  3. Payment Methods — Manage wallets and cards
  4. Notifications — Bank notification detection log
  5. x402 Resources — Manage gated endpoints
  6. Stripe — Checkout sessions and issuing cards

API Reference

See Payments API for complete endpoint documentation.