APIs have traditionally been monetized in one of two ways: a free tier with rate limits, or paid tiers with API keys and subscription billing. Both models assume a human developer on the other side - someone who can create an account, enter a card number, and manage a subscription. AI agents do not fit that model. They discover capabilities at runtime, pay for access in the moment, and do not maintain billing relationships in advance.
On-chain payment gates offer a different approach: the agent pays per request, on-chain, in real time. No account creation, no subscription management, no credit card. This guide covers how to implement this using DropPay and what pricing models work well for API providers.
Why existing monetization models fall short for AI traffic
API keys and subscription tiers work well when developers integrate your API into products. They negotiate once, set up billing, and use the API continuously. The relationship is stable and predictable from a revenue perspective.
AI agents introduce a different pattern. A single agent orchestrating a complex task might call dozens of different APIs in a session, none of which the agent operator has pre-established relationships with. Requiring account creation and subscription setup before every new API access is not practical at agent scale.
Rate-limited free tiers partially solve discovery but do not solve monetization. If agents can get meaningful value from free tiers, providers are subsidising agent traffic indefinitely. If free tiers are too restricted to be useful, agents skip the service.
Per-call payment at the protocol level changes this. Agents pay for exactly what they use, at the point of use, with no advance relationship required. Providers charge for value delivered. The economics are direct.
How payment gates work on an API
A payment gate is a layer in your API that requires proof of payment before delivering a response. The x402 protocol implements this at the HTTP level.
When a client requests a paid resource, your server returns HTTP 402 with a payment specification - the amount required, the destination wallet, and a reference identifier. The client (whether an AI agent or a developer's script) executes the payment on-chain, then retries the request with the transaction hash as proof. Your server calls DropPay's verification endpoint to confirm the payment, then delivers the resource.
DropPay's Embedded Checkout API handles the payment request creation and verification. One line of integration on your server generates the payment specification. The verification call confirms payment before your resource handler runs. Full implementation details are in the developer documentation.
Pricing strategies for AI agent traffic
Per-call pricing. The most direct model. Each API call costs a fixed XRP amount. Works well for APIs where calls have relatively uniform cost and value - search queries, data lookups, content retrieval. Set the price above your hosting cost per call with enough margin to cover overhead.
Per-data-unit pricing. For APIs that return variable amounts of data, pricing per token, per record, or per unit of content is more fair to both sides than flat per-call pricing. An agent retrieving ten records pays proportionally less than one retrieving a thousand. This requires tracking the output size and setting the payment amount dynamically in the 402 response.
Tiered access pricing. Some endpoints are more valuable than others. A basic search endpoint might charge 0.1 XRP per call. A premium endpoint with higher-quality data or lower latency might charge 1.0 XRP. Agents discover the price from the 402 response and decide whether the value justifies the cost.
Prepaid credit model. Instead of per-call payment, require a credit deposit before access. The agent makes a larger initial payment, which is tracked against subsequent requests until the credit is exhausted. This reduces the per-request overhead while maintaining pay-per-use economics. Requires credit tracking in your application layer.
XRP's sub-cent network fees make micropayments viable. A payment of 0.1 XRP carries a network fee of under $0.001. This means you can charge for small units of value without fees eating into the economics on either side.
Integration overview
Adding payment gates to your API with DropPay involves four components:
- A DropPay Pro account with your XRP wallet connected. This is where payments arrive. API access and webhook support are required for programmatic integration.
- A payment request endpoint on your server. When a client hits a gated resource, your server creates a DropPay payment request and returns the 402 response with payment details. The DropPay API provides the payment specification your 402 response should include.
- Payment verification. After the client submits a transaction hash, your server calls DropPay's verification endpoint to confirm the payment on the XRP Ledger before delivering the resource.
- A webhook handler. DropPay fires a webhook on every confirmed payment. You can use this to update access logs, credit balances, or trigger fulfillment asynchronously.
The developer documentation has the full endpoint reference, request format, and code examples. The x402 guide covers the protocol-level flow in detail.
Use cases in practice
A financial data API. A provider of real-time market data, economic indicators, or alternative financial datasets charges 0.5 XRP per query. AI agents researching investment decisions, running market analysis, or building reports pay per query. No subscription required, no rate limit per account - just payment per call.
A specialist inference API. A company running a domain-specific model (legal reasoning, medical literature summarisation, code analysis) charges per inference call. General-purpose AI agents that need specialist capabilities can access them on demand by paying at the protocol layer, without a billing relationship between the operators.
A content or media licensing API. A provider of licensed images, text, or media charges per asset retrieved. AI agents building content pipelines can access licensed material at point of use. The on-chain payment record serves as a usage log for rights management.
Frequently asked questions
Do I need to drop my existing API key model? No. On-chain payment gates can coexist with your existing authentication and billing. You might offer subscription access via API keys to human developers and x402 payment gates to AI agents. The two paths can run in parallel.
How do I handle cases where an agent pays but the request fails? XRP transactions on the ledger are final. If your API errors after a confirmed payment, you handle the refund manually as a new outgoing transaction from your wallet. Build retry logic carefully - verify payment before processing, and process requests idempotently where possible to avoid double-charging on retries.
What currency do I receive payment in? Payments arrive in your wallet as XRP. You convert to local currency on your preferred exchange schedule. The XRP conversion guide covers the process for major markets.
Is there a minimum payment amount? DropPay has no minimum beyond the XRP Ledger's minimum transaction requirement, which is a fraction of a cent. In practice, per-call pricing tends to work best in the 0.1 to 10 XRP range for most API use cases.
Pro includes full API access, webhooks, and x402 support. Create an account to get started.
Create your account