Skip to main content

API Reference

The ItPay Protocol defines 13 REST endpoints organized into five logical groups: Payment Flows, Service Lifecycle, Security, and Integration.


Capability Index

Payment Flows

#CapabilityEndpointHTTPPurposeState Machine
1Request Payment/v1/payment-intentsPOSTQR-based payment with human scanpending → qr_generated → scanning → authorized → captured → succeeded | expired | cancelled
2Cumulative Pay/v1/cumulative/record + /v1/cumulative/summaryPOST + GETUsage-based post-paid billingrecording → invoiced → payment_pending → paid | overdue
3One-Time Pay/v1/payments/one-timePOSTSimplified instant payment (deep link)pending → completed | failed
4Subscribe Pay/v1/subscriptionsPOSTRecurring subscription with auto-renewpending → active → past_due → cancelled → expired
5Refunds & Revocations/v1/refundsPOSTFull/partial refunds with automatic access revocationrequested → processing → succeeded | failed
6Void Service/v1/voidsPOSTCancel a payment intent, subscription, or recordrequested → voided | failed

Service Lifecycle

#CapabilityEndpointHTTPPurpose
7Broadcast & Discovery/v1/servicesPOST / GETRegister ServiceManifest and search services
8Install/v1/installsPOSTBind payer to service with spending limits
9KYC / KYB/v1/kyc/verifyPOSTIdentity verification for payment limits
10Deliveries/v1/deliveriesPOSTPost-payment encrypted fulfillment

Security

#CapabilityEndpointHTTPPurpose
11API Key Management/v1/api-keysPOST / GETStructured multi-key credential management
12Webhook Encryption/v1/webhook-endpointsPOSTRegister E2E-encrypted webhook endpoints
13Escrow Payments/v1/escrowsPOSTTrust-minimized payment with dispute resolution

How the Capabilities Relate

┌─────────────────────┐
│ Discover + Install │
│ (7. Broadcast │
│ 8. Install │
│ 9. KYC/KYB) │
└──────────┬──────────┘

┌──────────────────────────┼──────────────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌────────────────┐ ┌──────────────────┐
│ QR Payment │ │ Usage-Based │ │ Subscription │
│ 1. Request │ │ 2. Cumulative │ │ 4. Subscribe │
│ Payment │ │ Pay │ │ Pay │
│ 3. One-Time│ └────────────────┘ └──────────────────┘
└──────┬──────┘ │
│ │
└──────────────────────────┬──────────────────────────────────┘

┌────────▼────────┐
│ Post-Payment │
│ 5. Refunds │
│ 6. Void │
│ 10. Deliveries │
└────────┬────────┘

┌────────▼────────┐
│ Security │
│ 11. API Keys │
│ 12. Webhook Enc │
│ 13. Escrow │
└─────────────────┘

Flow

  1. Discover & Install — A paying agent finds a service via Broadcast & Discovery or MCP tools/list. For repeated use, the payer installs the service with spending limits and auto-pay preferences.

  2. Choose a payment method — Depending on the service's billing model:

    • Request Payment (QR) — Human scans a QR code to authorize payment.
    • Cumulative Pay — Usage recorded over a billing period and invoiced at end.
    • Subscribe Pay — Recurring fixed-interval payments with optional auto-renew.
    • One-Time Pay — Simplified instant payment via deep link.
  3. Post-payment — After a payment completes:

    • Refunds & Revocations — Return funds and automatically revoke access.
    • Void — Cancel before settlement.
    • Deliveries — Deliver encrypted digital goods.
  4. Security — Configure API keys, encrypted webhooks, or escrow for high-value transactions.


Common Patterns

Payment Method Discovery via MCP

Every ServiceManifest maps to one or more MCP tools. See MCP Integration for details.

HTTP 402 (x402) Semantics

Request Payment and One-Time Pay support the HTTP 402 Payment Required pattern. See x402 Semantics.

Webhook Events

Capabilities 1–6 emit webhook events to the service's registered endpoint URL. Event types follow <object>.<transition>, e.g. payment_intent.succeeded.


Next Steps