Metadata-Version: 2.4
Name: pay402
Version: 0.1.0a1
Summary: Buy anything behind an HTTP 402. No account, no API key.
Project-URL: Homepage, https://pay402.sh
Project-URL: Source, https://github.com/bitfent/checkout402
Author: checkout402
License: MIT
Keywords: 402,agents,payments,stablecoin,usdc,x402
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.10
Requires-Dist: httpx>=0.24
Provides-Extra: all
Requires-Dist: eth-account>=0.11; extra == 'all'
Requires-Dist: solders>=0.21; extra == 'all'
Provides-Extra: evm
Requires-Dist: eth-account>=0.11; extra == 'evm'
Provides-Extra: solana
Requires-Dist: solders>=0.21; extra == 'solana'
Description-Content-Type: text/markdown

# pay402

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

> **Alpha (`0.1.0a1`).** Base is proven — a real mainnet settlement, verified on
> chain: buyer −$0.02005, seller +$0.01, fee wallet +$0.01005, splitter kept
> nothing. **Solana is implemented and adversarially tested but has never
> settled on chain**, so treat that path as unreleased. The interface may still
> move before `1.0`.

```bash
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
```

```python
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>
