Skip to main content

BitPay payment gateway integration for python-getpaid ecosystem.

Project description

python-getpaid-bitpay

PyPI version Python versions License: MIT Documentation Status

BitPay cryptocurrency payment processor for python-getpaid.

This is a backend for python-getpaid that integrates BitPay payment gateway. It allows your application to accept both traditional fiat and various cryptocurrencies, with payments optionally converted to fiat or kept in crypto.

Features

  • Full Async Support: Built on top of httpx and anyio for high-performance asynchronous operations.
  • Cryptocurrency Support: Accept BTC, BCH, ETH, XRP, DOGE, LTC, and stablecoins like USDC, USDT, DAI, WBTC, SHIB.
  • Fiat Support: Supports over 200 fiat currencies (USD, EUR, GBP, PLN, JPY, CAD, etc.).
  • Dual Facade Support:
    • POS Facade: Lightweight invoice creation using only a POS Token.
    • Merchant Facade: Full control including invoice retrieval, cancellation, and refunds (requires private key and merchant token).
  • Secure Webhooks: Automatic verification of BitPay IPN (Instant Payment Notification) using HMAC-SHA256 signatures.
  • Refunds: Support for partial and full refunds via the BitPay API.
  • Framework Agnostic: Works with Django, Litestar, or any other Python web framework via python-getpaid-core.

Why not the official SDK?

This plugin uses its own native async HTTP client instead of wrapping the official BitPay Python SDK. The custom implementation provides:

  1. Async-first architecture: No thread offloading for sync calls.
  2. Minimal dependencies: Avoids version pinning conflicts (e.g., Pydantic).
  3. Clean testing: Built-in support for respx for reliable test doubles.

Installation

Install the package using pip:

pip install python-getpaid-bitpay

Configuration

Add bitpay to your GETPAID_BACKENDS setting and provide the necessary credentials.

Basic Configuration (POS Facade)

Only invoice creation is supported with this setup.

GETPAID_BACKENDS = (
    'getpaid_bitpay',
)

GETPAID_BACKEND_SETTINGS = {
    'bitpay': {
        'pos_token': 'your-bitpay-pos-token',
        'notification_url': 'https://your-domain.com/payments/{payment_id}/callback/',
        'redirect_url': 'https://your-domain.com/payments/{payment_id}/success/',
    }
}

Full Configuration (Merchant Facade)

Required for status polling and refunds. Requires an EC private key (secp256k1).

GETPAID_BACKEND_SETTINGS = {
    'bitpay': {
        'pos_token': 'your-bitpay-pos-token',
        'merchant_token': 'your-bitpay-merchant-token',
        'private_key_pem': '-----BEGIN EC PRIVATE KEY-----\n...',
        'sandbox': True,  # Use test.bitpay.com
        'notification_url': 'https://your-domain.com/payments/{payment_id}/callback/',
        'redirect_url': 'https://your-domain.com/payments/{payment_id}/success/',
    }
}

Supported Currencies

Cryptocurrencies

  • Bitcoin: BTC, BCH, WBTC
  • Ethereum: ETH
  • Others: XRP, DOGE, LTC, SHIB
  • Stablecoins: USDC, USDT, DAI

Fiat Currencies

Supports over 200 global currencies including USD, EUR, GBP, PLN, JPY, CAD, AUD, and many more.

Status Mapping

BitPay Status FSM Trigger Description
new confirm_prepared Invoice created, awaiting payment
paid confirm_payment Payment detected, awaiting confirmation
confirmed mark_as_paid Payment confirmed on blockchain
expired / invalid / declined fail Payment failed or expired

Links

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_getpaid_bitpay-3.0.0a2.tar.gz (58.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_getpaid_bitpay-3.0.0a2-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file python_getpaid_bitpay-3.0.0a2.tar.gz.

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a2.tar.gz
  • Upload date:
  • Size: 58.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_getpaid_bitpay-3.0.0a2.tar.gz
Algorithm Hash digest
SHA256 7cbc78ed9c6b9ddacea401bc352ccf08de75de4b4005ef7bda8198393296e629
MD5 a9d073134a4805a9b15d3c8ba97a0ce9
BLAKE2b-256 39b9a7a076fd8ef7033327c2f6e8a86a923ee462552847cd0b9cdaf40f5ec724

See more details on using hashes here.

File details

Details for the file python_getpaid_bitpay-3.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_getpaid_bitpay-3.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e7dbd9a44818985b615791dc1c49481fbcb66330ca73d3f1b82e774bc6362a
MD5 0e5a7b0114256439fd71170005fc88da
BLAKE2b-256 5c5b5ee15a60647aa9c78ac93a202b6de6c56ec8c94da31587e754aaf5f38b0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page