django-payments-blockbee


Namedjango-payments-blockbee JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/blockbee-io/django-payments-blockbee
SummaryBlockBee Checkout backend for django-payments.
upload_time2025-08-14 16:49:12
maintainerNone
docs_urlNone
authorBlockBee
requires_python>=3.8
licenseMIT
keywords django payments django-payments blockbee crypto checkout
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-payments-blockbee

[![PyPI - Version](https://img.shields.io/pypi/v/django-payments-blockbee.svg)](https://pypi.org/project/django-payments-blockbee)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-payments-blockbee.svg)](https://pypi.org/project/django-payments-blockbee)

-----

`django-payments-blockbee` adds support for the [BlockBee](https://blockbee.io) hosted checkout to [Django Payments](https://django-payments.readthedocs.io/).

**Table of Contents**

- [Installation](#installation)
- [Configuration](#configuration)
- [Webhook](#webhook)
- [Usage](#usage)
- [Security Features](#security-features)
- [Testing](#testing)
- [License](#license)

## Installation

```console
pip install django-payments-blockbee
```

## Configuration

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

```python
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:

```python
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](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/blockbee-io/django-payments-blockbee",
    "name": "django-payments-blockbee",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "django, payments, django-payments, blockbee, crypto, checkout",
    "author": "BlockBee",
    "author_email": "support@blockbee.io",
    "download_url": "https://files.pythonhosted.org/packages/2f/a7/ed644b91cd0af6f8744349b5c06f2923d1f7652ec298f83ea504c241df5d/django_payments_blockbee-1.0.5.tar.gz",
    "platform": null,
    "description": "# django-payments-blockbee\n\n[![PyPI - Version](https://img.shields.io/pypi/v/django-payments-blockbee.svg)](https://pypi.org/project/django-payments-blockbee)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-payments-blockbee.svg)](https://pypi.org/project/django-payments-blockbee)\n\n-----\n\n`django-payments-blockbee` adds support for the [BlockBee](https://blockbee.io) hosted checkout to [Django Payments](https://django-payments.readthedocs.io/).\n\n**Table of Contents**\n\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Webhook](#webhook)\n- [Usage](#usage)\n- [Security Features](#security-features)\n- [Testing](#testing)\n- [License](#license)\n\n## Installation\n\n```console\npip install django-payments-blockbee\n```\n\n## Configuration\n\nFollow the Django Payments setup (define a concrete `Payment` model and set `PAYMENT_MODEL`). Then add this variant:\n\n```python\nPAYMENT_VARIANTS = {\n    \"blockbee\": (\n        \"payments_blockbee.BlockBeeProvider\",\n        {\n            \"apikey\": \"your-blockbee-api-key\",\n        },\n    )\n}\n\n# Required django-payments settings\nPAYMENT_HOST = \"your-domain.com\"  # or ngrok URL for development\nPAYMENT_USES_SSL = True  # Set to False for local development\nPAYMENT_MODEL = \"your_app.Payment\"\n```\n\n### Available configuration options\n\n- `apikey`: Your BlockBee API key\n\n### Django-payments settings\n\n- `PAYMENT_HOST`: Your domain or ngrok URL for development\n- `PAYMENT_USES_SSL`: Set to `True` for production, `False` for local development\n- `PAYMENT_MODEL`: Your concrete Payment model\n\nNotes:\n- Currency is taken from the `Payment` instance (`payment.currency`, e.g. `\"EUR\"`).\n- The provider automatically constructs webhook and redirect URLs using django-payments standard endpoints.\n- We recommend using a public tunnel (ngrok/cloudflared) for local development.\n\n## Webhook\n\n**No custom webhook view needed!** The provider automatically handles webhooks through django-payments standard endpoints:\n\n- **Webhook URL**: `/payments/process/blockbee/` (automatically created by django-payments)\n- **Success URL**: Uses your payment model's `get_success_url()` method\n- **Method**: POST with signature verification\n\nThe provider processes POST webhooks and confirms the payment when `is_paid == \"1\"` and `status == \"done\"`.\n\n## Usage\n\nCreate a `Payment` and call `get_form()` or handle `RedirectNeeded` per Django Payments docs:\n\n```python\nfrom django.shortcuts import redirect, render\nfrom payments import RedirectNeeded, get_payment_model\n\ndef checkout(request):\n    Payment = get_payment_model()\n    payment = Payment.objects.create(\n        variant=\"blockbee\",\n        description=\"Order #123\",\n        total=\"10.00\",\n        currency=\"EUR\",\n    )\n    try:\n        # This will raise RedirectNeeded with BlockBee payment URL\n        payment.get_form(data=request.POST or None)\n    except RedirectNeeded as redirect_to:\n        # Django-payments automatically redirects user to BlockBee\n        return redirect(str(redirect_to))\n```\n\nOn 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`.\n\n## Security Features\n\n### Webhook Signature Verification\n\nThe provider automatically verifies BlockBee webhook signatures using RSA-SHA256:\n\n- **Algorithm**: RSA-SHA256 with PKCS1v15 padding\n- **Public Key**: Fetched dynamically from BlockBee's API\n- **Signature Header**: `x-ca-signature`\n- **Data Verified**: Request body for POST requests\n\n### Payment ID Mapping\n\n- BlockBee's `payment_id` is automatically mapped to your payment's `token` and `transaction_id`\n- This ensures consistent identification across both systems\n- No manual ID mapping required\n\n## Testing\n\nBlockBee does not provide a sandbox environment. Testing is done against live endpoints. Recommended practices:\n\n- Use small order amounts when developing (e.g., 1\u20132 USD) and low-fee networks/coins\n- Enable a public tunnel (ngrok/cloudflared) so your webhook endpoint is reachable\n- Treat webhook handling as idempotent (this provider already does)\n- Never expose secrets in client code; keep the API key in server-side settings\n\n## License\n\n`django-payments-blockbee` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "BlockBee Checkout backend for django-payments.",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/blockbee-io/django-payments-blockbee",
        "Source": "https://github.com/blockbee-io/django-payments-blockbee",
        "Tracker": "https://github.com/blockbee-io/django-payments-blockbee/issues"
    },
    "split_keywords": [
        "django",
        " payments",
        " django-payments",
        " blockbee",
        " crypto",
        " checkout"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "60ee838a8e693f11e255aebc9b1f07fa739e25f7ba2c7f60e347aa6e9b4fb84b",
                "md5": "26f72bdd5ce976d9ebe224d22b936fe1",
                "sha256": "1177a4eb9529e310c030305dabb21040516e4963e6fb320bca23c56dd1c19ee1"
            },
            "downloads": -1,
            "filename": "django_payments_blockbee-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "26f72bdd5ce976d9ebe224d22b936fe1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6118,
            "upload_time": "2025-08-14T16:49:11",
            "upload_time_iso_8601": "2025-08-14T16:49:11.695274Z",
            "url": "https://files.pythonhosted.org/packages/60/ee/838a8e693f11e255aebc9b1f07fa739e25f7ba2c7f60e347aa6e9b4fb84b/django_payments_blockbee-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2fa7ed644b91cd0af6f8744349b5c06f2923d1f7652ec298f83ea504c241df5d",
                "md5": "a571e90ac8fc630ca7f9676a07951a47",
                "sha256": "9db46464cba83e31835e49a4361af4ff8321e754e07ee31dd8f9a961d45d981b"
            },
            "downloads": -1,
            "filename": "django_payments_blockbee-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a571e90ac8fc630ca7f9676a07951a47",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6023,
            "upload_time": "2025-08-14T16:49:12",
            "upload_time_iso_8601": "2025-08-14T16:49:12.576849Z",
            "url": "https://files.pythonhosted.org/packages/2f/a7/ed644b91cd0af6f8744349b5c06f2923d1f7652ec298f83ea504c241df5d/django_payments_blockbee-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-14 16:49:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blockbee-io",
    "github_project": "django-payments-blockbee",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-payments-blockbee"
}
        
Elapsed time: 0.43719s