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.0a3.tar.gz (59.2 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.0a3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a3.tar.gz
  • Upload date:
  • Size: 59.2 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.0a3.tar.gz
Algorithm Hash digest
SHA256 ec9eacd4e8c646749143de1474fe828ae0a24d877a42347137568fa846514c4a
MD5 00bc8c5006fbe79addcfc521c627a198
BLAKE2b-256 761dd90648641eb7c68e51bbce28267a1c2c18274bd3fb0c3efe4464e1d9b8a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_getpaid_bitpay-3.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 c15d2352b362066ff6ac746ca2d417032cca7416b28cf7c392fd4019781ed20e
MD5 a28cf6a12b1379d0b4c816ead772c360
BLAKE2b-256 34ad78a8a7b831ce8e6d33800f3239b9e9f271d6aa6911e3b8c483f66084d3ca

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