Repository navigation
Releases
Releases · railpayapp/railpay-python
railpay-python v0.5.0
PaywallMiddleware: ASGI middleware that puts aPaywallin front of chosen paths of any ASGI app (Starlette, FastAPI…). Unpaid requests get the 402. Paid ones reach the app, withPAYMENT-RESPONSEadded to its answer.railpay.fastapi.require_payment(paywall): a FastAPI dependency that returns theCharge, withPaymentRequiredErrorandpayment_required_handlerfor an exact x402 402 body. Install it with the[fastapi]extra.- Examples:
examples/agent.py(payshttps://dapp.railpay.app/x402/time) andexamples/fastapi_seller.py. scripts/smoke.py: a read-only check against the live RailPay API and Robinhood Chain. It spends nothing.- README: seller integrations, examples and the full API.
railpay-python v0.4.0
Paywall: charge USDG for your own API. It returns the 402, checks the EIP-3009 authorization (recipient, amount, validity window, EIP-712 signature, then the payer's balance and the nonce on-chain), settles it through keyless x402 facilitators (Toll, then Primer) that pay the gas, and reports the request as paid only after the exact USDG transfer is in the receipt. A transfer that is not confirmed yet answerssettlement_pending.charge(url, headers)andhandle(url, headers, serve)work with any framework.PaymentStoreprotocol andMemoryStore: one payment unlocks one response. Pass a shared store with an atomicclaim()when you run more than one instance.- Signatures are recovered the same way the TypeScript SDK (viem) makes them, checked against a cross-implementation test vector.
- New runtime dependencies: eth-account, eth-utils and anyio.
railpay-python v0.3.0
AsyncRailPay: the async client, with the same methods asRailPay, onhttpx.AsyncClient.PaymentAuthandpaid_client()work withhttpx.AsyncClientwhen given anAsyncRailPay.on_paymentmay be a coroutine function.
railpay-python v0.2.0
PaymentAuth: anhttpx.Auththat answers an x402 v2402 Payment Requiredfrom a RailPay agent wallet and retries once withPAYMENT-SIGNATURE(the Python form ofwithPayment). It pays onlyexact/eip155:4663/ USDG options, andmax_amountrefuses a higher price before anything is signed. Request bodies, streamed ones included, are sent again on the retry.paid_client(railpay): anhttpx.Clientthat pays withPaymentAuth.read_payment_required(),read_payment_response(),is_railpay_payable()andrequirement_amount().
railpay-python v0.1.0
First release.
RailPayclient for the RailPay API on Robinhood Chain (chain id 4663):me(),pay(),send(),config(),stats()andrequest(), withrp_sk_Bearer keys. API errors raiseRailPayErrorwithstatus,codeandmessage.- x402 v2 wire types:
PaymentRequired,PaymentRequirements,PaymentPayload,SettleResponse. - Helpers for USDG units (
to_units,from_units), base64 JSON headers (b64json,unb64json) and Robinhood Chain constants (USDG, EIP-712 domain, facilitators, explorer), with the same values as the TypeScript SDK. stats()needs an account key: network stats are for signed-in accounts.