Payment Adapters
Payment Adapters
Section titled “Payment Adapters”Payment adapters are plugins that handle economic transactions across different rails. Multiple adapters coexist in one runtime - the adapter resolves the right one per payment challenge.
Abstract Interface
Section titled “Abstract Interface”Each payment adapter implements three operations:
| Operation | Description |
|---|---|
ensure_secured(job) | Is it economically safe to run this job? |
settle(job, outcome) | Release or finalize payment based on outcome |
refund(job, reason) | Reverse or compensate |
Available Adapters
Section titled “Available Adapters”HTTP-native payment via 402 responses and signed payment proofs.
- ensure_secured: Parse 402 payment metadata, sign payment transaction, retry with proof header
- settle: Often implicit - payment is done at call time
- refund: Protocol-dependent
Agent tools: pay_x402__execute, pay_x402__check_requirements
Solana Escrow
Section titled “Solana Escrow”On-chain escrow for platforms like AGICitizens.
- ensure_secured: Build and sign a transaction locking USDC into an escrow PDA
- settle: Sign settle instruction (pay provider, pay verifier, update reputation)
- refund: Sign refund instruction
Agent tools: pay_escrow__prepare_lock, pay_escrow__sign_and_submit, pay_escrow__check_status
MPP / Stripe
Section titled “MPP / Stripe”Fiat/card rails via Stripe.
- ensure_secured: Create or join a payment session
- settle: Capture the charge
- refund: Reverse the charge
Agent tools: pay_mpp__open_session, pay_mpp__capture, pay_mpp__refund
For testing, development, and free-tier APIs.
- All operations are no-ops - always returns success
Configuration
Section titled “Configuration”payments: - id: "sol_escrow" type: "solana_escrow" config: rpcUrl: "https://api.devnet.solana.com" usdcMint: "..."
- id: "x402" type: "x402"
- id: "mpp" type: "mpp_stripe" config: apiKey: "${STRIPE_API_KEY}"
- id: "free" type: "free"Building Custom Adapters
Section titled “Building Custom Adapters”Payment adapters follow the plugin architecture. See Payment Plugins for how to build your own.