Skip to main content

pay402

Buy anything behind an HTTP 402. No account, no API key, no browser.

Both rails are proven on mainnet, with this code, verified against the chain rather than against anyone's database:

buyer seller fee wallet splitter
Base −$0.02005 +$0.01 +$0.01005 kept nothing
Solana −$0.02005 +$0.01 +$0.01005 n/a — no splitter

On both, the buyer held no native gas token: on Base the relayer submits the EIP-3009 authorization, on Solana it signs as fee payer. The interface may still move before 1.0.

pip install "pay402[evm]"
pay402 https://api.checkout402.com/c/chk_abc123 --quote
pay402 https://api.checkout402.com/c/chk_abc123 --key $PAY402_KEY --max-usd 1.00
from pay402 import pay
goods = pay(url, private_key=os.environ["AGENT_KEY"], max_usd="1.00")

Reads the 402 challenge, picks a chain it can sign for, signs, retries with X-PAYMENT, and hands back the goods plus a receipt. Base (EIP-3009) and Solana (SPL) today.

Guardrails

max_usd is required for a live payment. An agent looping on a paid endpoint with no ceiling is the failure mode that matters, so the default is refusal rather than a permissive setting someone forgets to override. Nothing is signed until the quoted total has passed the cap.

On Solana the payee builds the transaction and you sign it, so pay402 decodes it and refuses unless it does exactly what the 402 advertised: two transfers, to the quoted wallets, for the quoted amounts, out of your token account and no other, with no third program involved. Non-custodial should mean more than "they cannot hold your funds".

If you paid and the goods did not arrive, the error carries the receipt id — the one thing you need to get it resolved.

Extras

pay402[evm] for Base, pay402[solana] for Solana, pay402[all] for both. The base install is httpx only, so an agent sandbox will accept it.

MIT. Source: https://github.com/bitfent/checkout402

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pay402-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pay402-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file pay402-0.1.0.tar.gz.

File metadata

  • Download URL: pay402-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for pay402-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0ad99c77be35be08d9bedcf9d971cc7a0f0adf5d5bb48ea030381af7019d8cc
MD5 48cd1f510e8afcb6632580c236b16384
BLAKE2b-256 79402cbbb4b4079e18318513492685c2eee567ab6ec6607922e8b60a87916e3a

See more details on using hashes here.

File details

Details for the file pay402-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pay402-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for pay402-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 637786bd7de60fcddd4e48b33424fd62d93d749dc137b2118cbd463b524f323f
MD5 30bdd642804a9a64f9f68ded3ba53d06
BLAKE2b-256 fb7d2e05e7f3ee19fe980aa054916648ebdf3c003a6ad48f0e0e071f0b70b028

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page