Metadata-Version: 2.4
Name: okxweb3-app-paymentrouter
Version: 0.1.0
Summary: Unified multi-protocol payment middleware for Python web frameworks
Requires-Python: >=3.11
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100.0; extra == 'fastapi'
Description-Content-Type: text/markdown

# okxweb3-app-paymentrouter

Dual-protocol payment middleware that routes a single HTTP endpoint to both [x402](https://github.com/coinbase/x402) and [MPP](https://github.com/tempoxyz/pympp) clients. The seller writes one route; the router negotiates which protocol the caller speaks and emits the matching challenge/response headers.

## Install

```bash
pip install okxweb3-app-paymentrouter[fastapi]
```

## What it provides

- **`paymentrouter.router`** — request inspector that detects protocol (`x402`/`mpp`) from headers and dispatches to the right adapter.
- **`paymentrouter.adapter`** — pluggable adapters for `okxweb3-app-x402` and `okxweb3-app-mpp`.
- **`paymentrouter.fastapi`** — drop-in FastAPI `Depends()` integration.

## Why

Two payment protocols, one URL. Lets you accept payment from any client without forcing a protocol choice or duplicating endpoints. The challenge response carries both `WWW-Authenticate` (MPP) and `payment-required` (x402) headers — the client picks.
