x402  by coinbase

Payments protocol for internet resources, built on HTTP

created 5 months ago
748 stars

Top 47.4% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

x402 is an open, internet-native payments protocol designed to replace flawed, high-friction payment systems like credit cards. It enables seamless, low-fee digital payments for web resources, targeting developers building applications for humans and AI agents. The protocol leverages HTTP status codes and headers for integration, aiming for a 10x improvement over existing online payment methods.

How It Works

x402 utilizes the HTTP 402 Payment Required status code to signal that a payment is needed for a resource. Servers respond with PaymentRequirements, detailing accepted schemes, networks, and amounts. Clients then construct a PaymentPayload within the X-PAYMENT header, specifying their chosen payment method. Facilitator servers can be used by resource servers to verify and settle payments on-chain without direct blockchain interaction, abstracting away complexities like gas fees for clients and resource servers.

Quick Start & Requirements

  • Install dependencies and run examples using pnpm install and pnpm build in the typescript directory.
  • Run server examples (e.g., Express) with pnpm dev after setting the payment address in .env.
  • Run client examples (e.g., Axios) with pnpm dev after setting the payment private key in .env.
  • Official examples and documentation are available within the repository.

Highlighted Details

  • Aims for "1 line of code" integration for resource servers to accept payments.
  • Supports chain and token agnostic payment schemes, with exact for EVM chains as the initial scheme.
  • Facilitator servers abstract blockchain complexities, offering /verify, /settle, and /supported endpoints.
  • Extensible design allows for new payment schemes and network integrations.

Maintenance & Community

The project is maintained by Coinbase. Further community engagement details, such as Discord/Slack channels or a roadmap, are not explicitly detailed in the README.

Licensing & Compatibility

The project is licensed under the MIT License, permitting commercial use and integration with closed-source applications.

Limitations & Caveats

The protocol is described as "V1 Protocol," suggesting potential for future breaking changes. While the exact scheme for EVM chains is detailed, support for other schemes and networks is still under development. The README does not specify testing for non-EVM chains or alternative client/server implementations beyond the provided examples.

Health Check
Last commit

2 days ago

Responsiveness

1 week

Pull Requests (30d)
47
Issues (30d)
3
Star History
628 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.