AgnicPay

Core Concepts

Understand the key concepts behind AgnicPay - X402, wallets, tokens, and payment flows.

Core Concepts

Before diving into the API, it helps to understand the key concepts that power AgnicPay.

The X402 Protocol

X402 is a proposed HTTP status code (like 404 for "Not Found") that means "Payment Required". When an API returns 402, it includes payment instructions that tell the client how to pay for access.

How X402 Works

┌─────────┐                    ┌─────────┐                    ┌─────────┐
│  Your   │  1. Request data   │ X402    │                    │ Agnic   │
│  App    │ ────────────────>  │  API    │                    │  Pay    │
│         │                    │         │                    │         │
│         │  2. 402 + payment  │         │                    │         │
│         │ <───────────────── │         │                    │         │
│         │                    │         │                    │         │
│         │  3. Sign payment   │         │                    │         │
│         │ ────────────────────────────────────────────────> │         │
│         │                    │         │                    │         │
│         │  4. Payment proof  │         │                    │         │
│         │ <──────────────────────────────────────────────── │         │
│         │                    │         │                    │         │
│         │  5. Request + proof│         │                    │         │
│         │ ────────────────>  │         │                    │         │
│         │                    │         │                    │         │
│         │  6. 200 OK + data  │         │                    │         │
│         │ <───────────────── │         │                    │         │
└─────────┘                    └─────────┘                    └─────────┘

Why X402?

Traditional APIsX402 APIs
Sign up for each serviceOne wallet for all APIs
Manage multiple API keysPay-per-use, no subscriptions
Monthly billing cyclesInstant micropayments
Manual approval neededAutomated payments

Payment Schemes

AgnicPay supports two X402 payment schemes:

Exact Scheme (EIP-3009)

  • How it works: TransferWithAuthorization - funds transfer exactly on use
  • Best for: One-time payments, precise billing
  • Chains: Base (EVM), Solana

Upto Scheme (EIP-2612)

  • How it works: Permit - pre-authorize up to an amount
  • Best for: Streaming responses, variable costs
  • Chains: Base (EVM)

AgnicPay automatically detects and handles both schemes.

Wallets

Embedded Wallets

When you sign up, AgnicPay creates an embedded wallet for you using Privy. This wallet:

  • Is non-custodial (you control the keys)
  • Works on Base and Solana
  • Holds USDC for payments
  • Supports delegation for automated signing

Delegation (Session Signers)

To enable automated payments, you delegate signing authority to AgnicPay:

  1. You set spending limits (per-transaction, daily, monthly)
  2. You sign a delegation message
  3. AgnicPay can sign payments within your limits
  4. You can revoke access anytime

Delegation never gives AgnicPay access to your full balance - only the ability to sign payments within your specified limits.

API Tokens

API tokens authenticate requests to AgnicPay. Each token has:

PropertyDescription
maxPerTransactionMaximum USD per single payment
dailyLimitTotal USD allowed per 24 hours
monthlyLimitTotal USD allowed per 30 days
networksAllowed networks (Base, Solana)
labelYour custom label

Token Types

PrefixTypeUse Case
agnic_tok_API TokenDirect API access
agnic_at_OAuth Access TokenUser-authorized apps
agnic_rt_OAuth Refresh TokenRefresh access tokens

Spending Limits

Spending limits protect you from unexpected charges:

Per-Transaction Limit: $1.00
├── Blocks any single payment > $1.00
└── Useful for capping AI response costs

Daily Limit: $10.00
├── Resets every 24 hours
└── Prevents runaway automation

Monthly Limit: $50.00
├── Resets every 30 days
└── Budget control for long-term use

Networks

AgnicPay supports multiple blockchain networks:

NetworkTokenUse Case
Base (Mainnet)USDCProduction payments
Base SepoliaUSDC (testnet)Development/testing
SolanaUSDCProduction payments
Solana DevnetUSDC (devnet)Development/testing

OAuth tokens are restricted to mainnet networks only (Base, Solana). API tokens can access testnets.

Credits

New users receive $5 in free credits. Credits are used before your wallet balance and:

  • Never expire
  • Work on all networks
  • Are non-transferable
  • Don't require funding your wallet

Next Steps

On this page