A NowPayments.io client for Python
Project description
nowpayment - A payment gateway client for NowPayments.io
NOWPayments is a noncustodial crypto payment gateway that lets you accept payments in 300+ cryptocurrencies with auto coin conversion supported. The gateway is designed to be simple and fast to integrate, with low fees and no minimum balance required. It also supports instant settlement and has a variety of features, including integrated invoices and a donation page builder.
Requirements
- Python 3.8+
Installation
pip install nowpayment
Supported APIs
- Payments API
- Currency API
- Payout API
- Custody / Billing API (sub-partners)
- Subscriptions API (plans & recurring payments)
- Webhook / IPN verification helpers
Quick start
from nowpayment import NowPayments
np = NowPayments("API_KEY")
# np = NowPayments("SANDBOX_API_KEY", sandbox=True)
invoice = np.payment.create_invoice(
price_amount=1,
price_currency="USD",
)
currencies = np.currency.get_available_currencies()
Pass as_model=True on API methods to get typed response models instead of dict.
from nowpayment import Payment
payment = np.payment.create_payment(
price_amount=10,
price_currency="USD",
pay_currency="TRX",
order_id="order-1",
ipn_callback_url="https://example.com/ipn",
as_model=True,
)
print(payment.payment_status)
Webhooks (IPN)
from nowpayment import extract_ipn_signature, verify_ipn_payload, IPNVerificationError
signature = extract_ipn_signature(request.headers)
event = verify_ipn_payload(request.json, IPN_SECRET, signature)
Error handling
from nowpayment import NowPayments, NowPaymentsAPIError
try:
np.payment.get_payment_status("invalid-id")
except NowPaymentsAPIError as exc:
print(exc.status_code, exc.message)
Development
pip install -e ".[dev]"
pytest
More examples: examples/. Testing guide: docs/TESTING.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nowpayment-1.9.0.tar.gz.
File metadata
- Download URL: nowpayment-1.9.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60e835bd9e8eb1aab28d9fae1a810a87f3d9c6c21280f5dd4ebd8306d3db851e
|
|
| MD5 |
1d764c706f933f0fd3099da70c416567
|
|
| BLAKE2b-256 |
7df5af2852c6aa77a9c228519dfed6ec120d4b375b3b4a06d5606242378ddb83
|
File details
Details for the file nowpayment-1.9.0-py3-none-any.whl.
File metadata
- Download URL: nowpayment-1.9.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b69b3f06dcd9cc5cb65ee6db11c72e91d109775108e0c1d0fed60493adf960b
|
|
| MD5 |
62c25ad856c93dec06f5eb92e1061c62
|
|
| BLAKE2b-256 |
ce3499e2e75030cf45ee4e6730d8d5c4c6428bb9739eeb13e99874f525106a02
|