> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> SolvaPay quick facts:
> - REST API base URL: https://api.solvapay.com. All public endpoints are under /v1/sdk/ (for example GET https://api.solvapay.com/v1/sdk/products). Sandbox and production share this URL.
> - Auth: send a secret key as `Authorization: Bearer <secret key>` (the REST API also accepts `X-API-Key: <secret key>`).
> - Secret key prefixes: `sk_sandbox_` (sandbox, test payments) and `sk_live_` (production). The prefix selects the environment.
> - Get keys in SolvaPay Console (https://app.solvapay.com) > Developers > API Keys. Use a sandbox key while building.
> - Admin MCP Server: https://mcp.solvapay.com/mcp (Streamable HTTP). Connect with OAuth: add the URL and sign in with the SolvaPay account; no API key needed. OAuth sessions use the live account; for sandbox data or headless clients, send `Authorization: Bearer <secret key>` (X-API-Key is ignored).
> - Install the SolvaPay agent skills: `npx skills add https://solvapay.com` (skills CLI older than 1.5.7: `npx skills add solvapay/skills`).
> - TypeScript SDK setup: `npx solvapay@latest init`. The SDK reads SOLVAPAY_SECRET_KEY and defaults to https://api.solvapay.com.
> - Plans take an options[] array (billingCycle, charge, limit, ...). Retired plan fields price, freeUnits and billingCycle are rejected.
> - Step-by-step from zero to a first paid call: Managed MCP https://docs.solvapay.com/build/managed-mcp.md, TypeScript SDK https://docs.solvapay.com/build/typescript-sdk.md, agent skill https://docs.solvapay.com/build/agent-skill.md.
> - Details: https://docs.solvapay.com/api-reference/authentication.md. OpenAPI spec: https://docs.solvapay.com/api-reference/openapi.json.

# Python SDK

> Charge for Python functions, MCP tools and agent calls with SolvaPay, and verify SolvaPay webhooks.

The Python SDK (`solvapay` on PyPI) connects your Python service to SolvaPay. It needs Python 3.10 or later, is fully typed, and is async-first.

## What it does

* **Paid functions.** `@solvapay.payable()` checks each call against the customer's plan, runs your function when the call is allowed, and records the usage. When the call isn't allowed, it raises `PaywallError` with a message and a checkout link.
* **Paid MCP tools.** `create_solvapay_mcp_server` builds an MCP server where customers sign in with SolvaPay. It adds the built-in `account` and `activate_plan` tools and the checkout widget that ChatGPT and Claude open in the chat.
* **Webhooks.** `verify_webhook` checks the `sv-signature` header and returns the parsed event.
* **API client.** `AsyncApiClient` and `ApiClient` cover every SolvaPay SDK API operation, generated from the same spec as the TypeScript SDK.
* **Agent payments (preview).** `solvapay.agents` lets SolvaPay agents pay for each tool call.

```python theme={null}
from solvapay import create_solvapay

solvapay = create_solvapay()  # reads SOLVAPAY_SECRET_KEY and SOLVAPAY_PRODUCT_REF


@solvapay.payable()
async def summarise(text: str, *, customer_ref: str) -> str:
    return text[:100]
```

## Pages

| Page | What it answers |
| - | - |
| [Installation](https://docs.solvapay.com/sdks/python/setup/installation.md) | How to install the package and its extras, and which environment variables it reads |
| [Quick start](https://docs.solvapay.com/sdks/python/setup/quick-start.md) | How to make a function paid and serve it from a web route |
| [Paid MCP server](https://docs.solvapay.com/sdks/python/guides/mcp.md) | How to charge for MCP tools, with SolvaPay sign-in and the checkout widget |
| [API client](https://docs.solvapay.com/sdks/python/guides/api-client.md) | How to call the SolvaPay API directly and handle its errors |
| [Webhooks](https://docs.solvapay.com/sdks/python/guides/webhooks.md) | How to verify and handle SolvaPay webhooks |
| [React web checkout](https://docs.solvapay.com/sdks/python/guides/react-web-checkout.md) | How to serve the routes the `@solvapay/react` components call, so web checkout works with a Python backend |
| [Agent payments](https://docs.solvapay.com/sdks/python/guides/agents.md) | How to let SolvaPay agents pay per tool call (preview) |
| [Examples](https://docs.solvapay.com/sdks/python/guides/examples.md) | How to run the stock research example |

## Same behaviour as the TypeScript SDK

The paywall, its messages, the `account` and `activate_plan` answers, the widget's tools and webhook verification behave the same as in the [TypeScript SDK](https://docs.solvapay.com/sdks/typescript/intro.md). A shared conformance suite checks this on every change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.