Skip to main content

django-payments-blockbee

PyPI - Version PyPI - Python Version


django-payments-blockbee adds support for the BlockBee hosted checkout to Django Payments.

Table of Contents

Installation

pip install django-payments-blockbee

Configuration

Follow the Django Payments setup (define a concrete Payment model and set PAYMENT_MODEL). Then add this variant:

PAYMENT_VARIANTS = {
    "blockbee": (
        "payments_blockbee.BlockBeeProvider",
        {
            "apikey": "your-blockbee-api-key",
        },
    )
}

# Required django-payments settings
PAYMENT_HOST = "your-domain.com"  # or ngrok URL for development
PAYMENT_USES_SSL = True  # Set to False for local development
PAYMENT_MODEL = "your_app.Payment"

Available configuration options

  • apikey: Your BlockBee API key

Django-payments settings

  • PAYMENT_HOST: Your domain or ngrok URL for development
  • PAYMENT_USES_SSL: Set to True for production, False for local development
  • PAYMENT_MODEL: Your concrete Payment model

Notes:

  • Currency is taken from the Payment instance (payment.currency, e.g. "EUR").
  • The provider automatically constructs webhook and redirect URLs using django-payments standard endpoints.
  • We recommend using a public tunnel (ngrok/cloudflared) for local development.

Webhook

No custom webhook view needed! The provider automatically handles webhooks through django-payments standard endpoints:

  • Webhook URL: /payments/process/blockbee/ (automatically created by django-payments)
  • Success URL: Uses your payment model's get_success_url() method
  • Method: POST with signature verification

The provider processes POST webhooks and confirms the payment when is_paid == "1" and status == "done".

Usage

Create a Payment and call get_form() or handle RedirectNeeded per Django Payments docs:

from django.shortcuts import redirect, render
from payments import RedirectNeeded, get_payment_model

def checkout(request):
    Payment = get_payment_model()
    payment = Payment.objects.create(
        variant="blockbee",
        description="Order #123",
        total="10.00",
        currency="EUR",
    )
    try:
        # This will raise RedirectNeeded with BlockBee payment URL
        payment.get_form(data=request.POST or None)
    except RedirectNeeded as redirect_to:
        # Django-payments automatically redirects user to BlockBee
        return redirect(str(redirect_to))

On successful webhook processing, the provider will set the Payment status to confirmed. Useful webhook payload fields (like paid_amount_fiat, paid_coin, txid) are saved into payment.attrs.

Security Features

Webhook Signature Verification

The provider automatically verifies BlockBee webhook signatures using RSA-SHA256:

  • Algorithm: RSA-SHA256 with PKCS1v15 padding
  • Public Key: Fetched dynamically from BlockBee's API
  • Signature Header: x-ca-signature
  • Data Verified: Request body for POST requests

Payment ID Mapping

  • BlockBee's payment_id is automatically mapped to your payment's token and transaction_id
  • This ensures consistent identification across both systems
  • No manual ID mapping required

Testing

BlockBee does not provide a sandbox environment. Testing is done against live endpoints. Recommended practices:

  • Use small order amounts when developing (e.g., 1–2 USD) and low-fee networks/coins
  • Enable a public tunnel (ngrok/cloudflared) so your webhook endpoint is reachable
  • Treat webhook handling as idempotent (this provider already does)
  • Never expose secrets in client code; keep the API key in server-side settings

License

django-payments-blockbee is distributed under the terms of the MIT license.

Metadata

Release files for django-payments-blockbee 1.0.5

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

Source distribution (sdist)

Source distribution for django-payments-blockbee 1.0.5
File Size Uploaded Provenance Actions
django_payments_blockbee-1.0.5.tar.gz 6.0 kB Without provenance Details for django_payments_blockbee-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-payments-blockbee 1.0.5
File Interpreter ABI Platform Actions
django_payments_blockbee-1.0.5-py3-none-any.whl Python 3 none any Details for django_payments_blockbee-1.0.5-py3-none-any.whl

Total release size: 12.1 kB

Release files / django_payments_blockbee-1.0.5.tar.gz

Download URL django_payments_blockbee-1.0.5.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9db46464cba83e31835e49a4361af4ff8321e754e07ee31dd8f9a961d45d981b
BLAKE2b-256 checksum
How to use checksums
2fa7ed644b91cd0af6f8744349b5c06f2923d1f7652ec298f83ea504c241df5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.0

Release files / django_payments_blockbee-1.0.5-py3-none-any.whl

Download URL django_payments_blockbee-1.0.5-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1177a4eb9529e310c030305dabb21040516e4963e6fb320bca23c56dd1c19ee1
BLAKE2b-256 checksum
How to use checksums
60ee838a8e693f11e255aebc9b1f07fa739e25f7ba2c7f60e347aa6e9b4fb84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.0

Security for django-payments-blockbee 1.0.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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