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 Semantic Event Description
new prepared Invoice created, awaiting payment
paid payment_captured Payment detected, awaiting confirmation
confirmed payment_captured Payment confirmed on blockchain
expired / invalid / declined failed 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.0a4.tar.gz (59.3 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.0a4-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a4.tar.gz
  • Upload date:
  • Size: 59.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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.0a4.tar.gz
Algorithm Hash digest
SHA256 17600bb2cfd0a7a4839fca6c5c84615a773e745babb95ea3bf0c2a0d0f62aa5c
MD5 c8a409be6cd394a6554e2b59a11c8dde
BLAKE2b-256 0d309b98d8a4e232b8bc567a7daf528d2f2c96edd28bc7ff8fa291049e923538

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 e8d8e0b9e455216dbc2a5262de8a131615aca5e24e56f029b9b5745794b54248
MD5 12a377af73b151b9ae1b842dca91b44c
BLAKE2b-256 60a6edb3c131ce833d594b9720363ddfd95eef42cd7ff97c633385425e1a9d1e

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