Skip to main content

pip install paystage

paystage (Python)

A thin Python client for the hosted PayStage MCP endpoint at https://api.paystage.xyz/mcp.

This package is a transport. It speaks JSON-RPC 2.0 to the hosted endpoint over HTTPS, sends your payment_required challenge and your policy inline, and returns the verdict the hosted tool produced. The evaluator is TypeScript — the same @paystage/mcp tools served by the Worker and over stdio. There is no policy engine, no fallback verdict, no signing code and no key in this package. If the endpoint is unreachable, the client raises; it never guesses a verdict locally.

The verdict strings are the same eight named across the MCP tool descriptions — pay, review, do_not_pay, allow, do_not_trade, VALID, INVALID, UNVERIFIABLE — and this client does not re-spell them. The one tool this transport calls, evaluate_mcp_payment, returns the first three. A review result carries the same packet object the TypeScript tool builds; pay and do_not_pay do not.

Use

from paystage import PayStageClient

with PayStageClient() as client:
    result = client.evaluate(payment_required=challenge, policy=policy)
    print(result.decision)  # "pay" | "review" | "do_not_pay"
    if result.is_review:
        print(result.packet["decision"]["question"])

One-shot form:

from paystage import evaluate

result = evaluate(challenge, policy)

result is an Evaluation with:

Attribute Meaning
decision the evaluator's verdict string, unchanged
packet the review-packet object on review, otherwise None
reasons the evaluator's reason strings, in order
summary the evaluator's one-line summary
result the complete payload, including hosted-only fields such as seller_reputation

result["decision"] also works, because Evaluation indexes into result.

agent_id and payment_identifier can be passed to evaluate(). They are forwarded as the tool arguments of the same names. PayStageClient.source sets the X-PayStage-Source header for labelled test traffic; leave it unset for real calls.

PayStageClient.call_tool(name, arguments) is the raw escape hatch for the other read-only MCP tools. It returns the unmodified tools/call result.

Contract with the TypeScript evaluator

The tests do not contain a second evaluator:

  • non-live tests prove the JSON-RPC envelope, the SSE parsing, error handling, and that review surfaces packet. They also read the TypeScript Decision union and review-packet schema from source and assert this package's constants match.
  • pytest -m live runs the same inputs through the hosted endpoint and through the real TypeScript evaluator (tests/ts_evaluator.mjs imports the built @paystage/preflight), then compares decision, reasons and the packet. It is skipped when node or packages/preflight/dist is absent.
pytest                 # stubbed, no network
pytest -m live         # hosted endpoint + TypeScript evaluator

The live test sends X-PayStage-Source: test.

Requirements and licence

Python 3.9 or newer. No runtime dependencies: urllib.request only. MIT.

Metadata

Release files for paystage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paystage 0.1.0
File Size Uploaded Provenance Actions
paystage-0.1.0.tar.gz 11.5 kB With provenance Details for paystage-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paystage 0.1.0
File Interpreter ABI Platform Actions
paystage-0.1.0-py3-none-any.whl Python 3 none any Details for paystage-0.1.0-py3-none-any.whl

Total release size: 19.5 kB

Release files / paystage-0.1.0.tar.gz

Download URL paystage-0.1.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6750b678dabe37a7fe4d464a4d14cfa8216c6b53c285a43f269c17a25f3c8b53
BLAKE2b-256 checksum
How to use checksums
6e86f439cbd82724dfd032a45b0a57b92c6324b722f5e38de2b3d820608ca4df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / paystage-0.1.0-py3-none-any.whl

Download URL paystage-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e82dfa80968e6408e0849573718997d8f2abf895f34b493f5c890feff759de40
BLAKE2b-256 checksum
How to use checksums
8fb7a386ee5d06667d76b22cbd3de221f4b24d703332a5de2e4b1b4d88fd1ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for paystage 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for paystage-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page