Accept crypto payments with the Python SDK
The official CryptoPayr Python SDK is a pure standard-library client — zero dependencies — for accepting Bitcoin, Ethereum, USDT and 30+ cryptocurrencies in Django, Flask, FastAPI or any Python service.
How to accept crypto payments with the Python SDK
Follow these steps to start taking Bitcoin, Ethereum, USDT and 30+ other coins.
-
Install the SDK
Run
pip install cryptopayr, or vendor the single module directly — it has no third-party dependencies. -
Initialise the client
Create the client with your secret API key from Dashboard → Developers:
cp = cryptopayr.Client("sk_live_…") -
Create a payment
Call
cp.payments.create(amount=…, currency="USD", metadata=order_id)and read the returnedcheckout_urland transaction id. -
Redirect to the hosted checkout
Send the customer to the
checkout_url. They choose a coin and pay; CryptoPayr manages addresses, fees and confirmations. -
Verify the webhook
In your webhook view, call
cryptopayr.Webhook.verify(body, signature, api_key)and fulfil the order when the eventstatusisCOMPLETED.
Need the full reference? See the API & webhook documentation, or read about the crypto payment gateway.
Requirements & compatibility
- Python 3.7 or newer
- Zero external dependencies
- A free CryptoPayr account & API key
- An HTTPS endpoint to receive webhooks
Frequently asked questions
Which frameworks does it work with?
Any of them — the client is framework-agnostic. Use it from Django, Flask, FastAPI, a worker or a plain script.
How do I verify webhooks?
Use Webhook.verify(), which checks the HMAC-SHA256 signature in the X-CryptoPayr-Signature header against your API key before you trust the payload.
Is the SDK synchronous?
Yes, the core client is simple and synchronous; call it from a background task or thread if you need non-blocking behaviour.
Where are the full examples?
See the API documentation for payments, payouts, refunds, balances, rates and conversion.