Python API Integration Integration
Integrate robust, server-side crypto processing into your Python backend. Effortlessly automate direct-to-wallet invoices, secure webhook listeners, and multi-token payouts with minimal configuration.
About This Integration
Everything you need to know about setting up this payment gateway
Accelerate your backend development with PayerURLβs official, open-source SDK for Python. Distributed under the MIT license, this lightweight package allows developers to integrate a decentralized, direct-to-wallet checkout experience in under 10 minutes without complex merchant onboarding. The system handles automated currency conversions across 169+ fiat pairs using real-time market rates and securely signs every API payload using robust HMAC SHA256 signatures to eliminate tampering risks. Once a user triggers a Binance Pay QR code or transfers on-chain assets, your backend applicationβs notify_url instantly receives an asynchronous server-to-server webhook to process order fulfillment automatically.
Need a Custom Solution?
For high-volume marketplaces, multi-vendor stores, and large enterprises. Get custom token integrations, dedicated API routing, and 24/7 priority developer support.
Why Developers Choose This Package
Trusted by 1,000+ active merchants worldwide with 29 five-star reviews on WordPress.org
No Merchant Account Needed
Payments go directly to your crypto wallet with zero middlemen
169+ Fiat Currencies
USD, EUR, GBP, CAD, JPY and more β converted at live market rates
10-Minute Integration
Simple pip install, clear docs, copy-paste code for any framework
No KYC for Withdrawals
Basic accounts withdraw without any identity verification
Binance QR Code Payments
Customers scan and pay without ever leaving your app
Zero Hidden Fees
No network surcharges or platform fees on the SDK
Django, Flask & FastAPI Ready
Works with any Python web framework out of the box
Auto Webhook Validation
CryptoPaymentNotify handles auth, signature, and status automatically
29 Five-Star Reviews
Verified on WordPress.org β praised for support and reliability
24/7 Telegram Support
Real humans, fast hands-on help for any integration issue
Installation Guide
Follow these steps to get up and running in 5 Min Setup
1π¦ Installation via pip
pip install binance-and-crypto-payment python-dotenv2π Get Your API Keys (Free)
- Sign up at dash.payerurl.com β takes under 2 minutes, no credit card required
- Go to Dashboard β Get API Credentials
- Copy your Public Key and Secret Key
3π Secure Configuration
Create a .env file in your project root and add it to .gitignore:
PAYERURL_PUBLIC_KEY=your_public_key
PAYERURL_SECRET_KEY=your_secret_key
BASE_URL=https://yourdomain.comβ οΈ In production β skip the .env file and set these variables directly in your hosting dashboard (Railway, Render, Heroku, VPS).
4π Quick Start
import os
import time
from dotenv import load_dotenv
from binance_and_crypto_payment import CryptoPaymentClient
load_dotenv()
client = CryptoPaymentClient(
public_key=os.getenv("PAYERURL_PUBLIC_KEY"),
secret_key=os.getenv("PAYERURL_SECRET_KEY")
)
BASE_URL = os.getenv("BASE_URL", "http://localhost:8000").rstrip("/")
items = [{"name": "Product", "qty": "1", "price": "10.00"}]
data = {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"redirect_url": f"{BASE_URL}/payment/success/",
"notify_url": f"{BASE_URL}/payment/notify/",
"cancel_url": f"{BASE_URL}/payment/cancel/",
}
response = client.payment(
invoice_id=f"PYP-{int(time.time())}",
amount=10.00,
currency="USD",
items=items,
data=data
)
payment_url = response["redirect_to"]
print(payment_url) # Redirect customer here5π Django Integration
Checkout view, success/cancel callbacks, and webhook handler:
# views.py
from django.views import View
from django.http import JsonResponse, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from binance_and_crypto_payment import CryptoPaymentClient, CryptoPaymentNotify, CryptoPaymentException
class CheckoutView(View):
def post(self, request):
client = CryptoPaymentClient(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
response = client.payment(
invoice_id=f"PYP-{int(time.time())}",
amount=float(request.POST.get("amount", 10.00)),
currency="USD",
items=[{"name": "Order", "qty": "1", "price": request.POST.get("amount", "10.00")}],
data={
"first_name": request.user.first_name,
"last_name": request.user.last_name,
"email": request.user.email,
"redirect_url": f"{BASE_URL}/payment/success/",
"notify_url": f"{BASE_URL}/payment/notify/",
"cancel_url": f"{BASE_URL}/payment/cancel/",
}
)
return redirect(response["redirect_to"])
@csrf_exempt
@require_POST
def notify_payerurl(request):
notify = CryptoPaymentNotify(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
try:
result = notify.process(request)
except CryptoPaymentException as e:
return JsonResponse({"status": e.code, "message": e.message}, status=200)
if result["type"] == "cancelled":
return JsonResponse({"status": 20000, "message": "Order cancelled"}, status=200)
data = result["data"]
# YOUR BUSINESS LOGIC HERE
# data["order_id"], data["transaction_id"], data["confirm_rcv_amnt"]
return JsonResponse({"status": 2040, "message": "Payment processed successfully"}, status=200)# urls.py
urlpatterns = [
path("payment/checkout/", CheckoutView.as_view(), name="checkout"),
path("payment/success/", payment_success, name="payment_success"),
path("payment/cancel/", payment_cancel, name="payment_cancel"),
path("payment/notify/", notify_payerurl, name="payment_notify"),
]6π Flask Integration
from flask import Flask, request, redirect, jsonify
from binance_and_crypto_payment import CryptoPaymentClient, CryptoPaymentNotify, CryptoPaymentException
app = Flask(__name__)
@app.route("/payment/checkout/", methods=["POST"])
def checkout():
client = CryptoPaymentClient(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
response = client.payment(
invoice_id=f"PYP-{int(time.time())}",
amount=float(request.form.get("amount", 10.00)),
currency="USD",
items=[{"name": "Order", "qty": "1", "price": request.form.get("amount", "10.00")}],
data={
"first_name": request.form.get("first_name"),
"last_name": request.form.get("last_name"),
"email": request.form.get("email"),
"redirect_url": f"{BASE_URL}/payment/success/",
"notify_url": f"{BASE_URL}/payment/notify/",
"cancel_url": f"{BASE_URL}/payment/cancel/",
}
)
return redirect(response["redirect_to"])
@app.route("/payment/notify/", methods=["POST"])
def notify_payerurl():
notify = CryptoPaymentNotify(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
try:
result = notify.process(request)
except CryptoPaymentException as e:
return jsonify({"status": e.code, "message": e.message}), 200
if result["type"] == "cancelled":
return jsonify({"status": 20000, "message": "Order cancelled"}), 200
data = result["data"]
# YOUR BUSINESS LOGIC HERE
return jsonify({"status": 2040, "message": "Payment processed successfully"}), 2007π FastAPI Integration
from fastapi import FastAPI, Request, Form
from fastapi.responses import JSONResponse, RedirectResponse
from binance_and_crypto_payment import CryptoPaymentClient, CryptoPaymentNotify, CryptoPaymentException
app = FastAPI()
@app.post("/payment/checkout/")
async def checkout(amount: float = Form(...), first_name: str = Form(...),
last_name: str = Form(...), email: str = Form(...)):
client = CryptoPaymentClient(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
response = client.payment(
invoice_id=f"PYP-{int(time.time())}",
amount=amount, currency="USD",
items=[{"name": "Order", "qty": "1", "price": str(amount)}],
data={
"first_name": first_name, "last_name": last_name, "email": email,
"redirect_url": f"{BASE_URL}/payment/success/",
"notify_url": f"{BASE_URL}/payment/notify/",
"cancel_url": f"{BASE_URL}/payment/cancel/",
}
)
return RedirectResponse(url=response["redirect_to"])
@app.post("/payment/notify/")
async def notify_payerurl(request: Request):
notify = CryptoPaymentNotify(public_key=PUBLIC_KEY, secret_key=SECRET_KEY)
try:
result = notify.process(request)
except CryptoPaymentException as e:
return JSONResponse({"status": e.code, "message": e.message}, status_code=200)
if result["type"] == "cancelled":
return JSONResponse({"status": 20000, "message": "Order cancelled"}, status_code=200)
data = result["data"]
# YOUR BUSINESS LOGIC HERE
return JSONResponse({"status": 2040, "message": "Payment processed successfully"}, status_code=200)uvicorn main:app --reloadSupported Cryptocurrencies & Networks
Webhook Reference
Callback URL Summary
| URL | Trigger | Method |
|---|---|---|
redirect_url | Customer paid successfully | GET (browser redirect) |
cancel_url | Customer cancelled payment | GET (browser redirect) |
notify_url | Gateway confirms payment server-side | POST (webhook) |
π‘ redirect_url and cancel_url are browser redirects β use them to show the customer a page. notify_url is a server-side webhook β use it to update your database.
Webhook Payload Fields
| Field | Description |
|---|---|
order_id | Your original invoice ID |
transaction_id | Blockchain transaction hash |
status_code | 200 = completed, 20000 = cancelled |
confirm_rcv_amnt | Amount received in fiat |
confirm_rcv_amnt_curr | Fiat currency (e.g. USD) |
coin_rcv_amnt | Amount received in crypto |
coin_rcv_amnt_curr | Crypto symbol (e.g. USDT) |
txn_time | Transaction timestamp |
Notify Response Codes
| Code | Meaning |
|---|---|
2040 | Payment processed successfully |
2030 | Auth error (key mismatch or missing) |
2031 | Auth format error (invalid base64) |
2050 | Validation error (missing fields or incomplete order) |
20000 | Order cancelled |
5000 | Internal server error |
β οΈ Always return HTTP 200 for all responses β including errors. PayerURL reads the JSON status field, not the HTTP status code. Returning non-200 will cause indefinite retries.
Full Payment Flow
Your app calls the API and gets a payment URL via CryptoPaymentClient
Customer is redirected to a secure hosted checkout page
Customer scans the Binance QR code or pays with any supported crypto
Blockchain confirms the transaction β funds land directly in your wallet
redirect_url receives the customer browser redirect after payment
notify_url receives a signed POST webhook β update your database here
Your App βββΊ PayerURL API βββΊ Checkout Page βββΊ Customer Pays
β
Your Wallet βββ Funds (instant) βββ Blockchain Confirmed β
β β
redirect_url (success/cancel) βββββββββββββ β
notify_url (webhook) ββββββββββββββββββββββββCompared to Other Solutions
| Feature | PayerURL | Stripe / PayPal | Coinbase Commerce |
|---|---|---|---|
| No merchant account | β | β | β |
| Direct to your wallet | β | β | Partial |
| No KYC required | β (Basic) | β | β |
| Binance QR support | β | β | β |
| Python SDK | β | β | β |
| Django / Flask / FastAPI | β | β | β |
| 169+ fiat currencies | β | Partial | β |
| Zero platform fees | β | β | β |
| Webhook support | β | β | β |
Frequently Asked Questions
Do I need a Binance account?
Yes, to accept Binance QR payments. For USDT/BTC/ETH/USDC, you only need the corresponding wallet address configured in your PayerURL dashboard.
Is there a transaction fee?
No platform fees from PayerURL. Standard blockchain network fees may apply depending on the coin and network chosen by the customer.
Can I use this without KYC?
Yes. Basic accounts can receive and withdraw crypto without mandatory identity verification.
What should my notify_url return?
Return {"status": 2040, "message": "Payment processed successfully"} with HTTP 200. Always return HTTP 200 for all responses β the gateway reads the JSON status field.
What is the difference between redirect_url and notify_url?
redirect_url is a browser redirect shown to the customer after payment. notify_url is a server-side webhook used to update your database β it fires independently of what the customer does.
Does this work with Django REST Framework / FastAPI?
Yes β it is a pure Python client that works with any Python web framework.
What Python versions are supported?
Python 3.8 and above (3.8, 3.9, 3.10, 3.11, 3.12, 3.13).
Key Features
- 169+ Fiat Currency Support (USD, EUR, GBP, JPY, AED, INR, BDT, etc.)
- Real-Time Exchange Rate Conversion
- Direct Wallet Settlement β PayerURL never holds your funds
- No KYC Required (Basic Accounts)
- HMAC-SHA256 Signature Verification via CryptoPaymentNotify
- Django, Flask, and FastAPI integration examples included
- Automatic webhook validation and error handling
- 100% Free & Open Source (MIT License)
- Python 3.8+ Compatible
- 24/7 Telegram Support
Requirements
- Python 3.8 or higher (3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
- pip packages: binance-and-crypto-payment, python-dotenv
- Free PayerURL merchant account
- A crypto wallet address to receive payments
- Publicly accessible HTTPS domain for notify_url
π§Ύ MIT License β free for personal and commercial use.
Ready to AcceptCrypto on WooCommerce?
Connect your store directly to your private wallets. Accept global payments with auto-rotating blockchain addresses, zero middleman custody, and instant status updates.