Skip to main content

PayBridge

PyPI version
Unified, modular payment gateway integration for Python. Connect to Paystack, Flutterwave, Monnify, and more with a single, developer-friendly API.


Features

  • Unified API for multiple payment gateways
  • Modular, extensible provider system
  • Circuit breaker and idempotency support
  • Fallback and load-balancing between providers
  • Webhook and refund handling
  • FastAPI and Flask integration
  • Type-safe models (Pydantic)

Installation

pip install paybridge

Quick Start

from paybridge import PayBridge

paybridge = PayBridge(
    provider="paystack",
    secret_key="sk_test_xxxxxxxxx"
)

response = paybridge.initialize_payment(
    amount=5000,
    email="customer@example.com",
    currency="NGN",
    reference="TXN_001"
)
print(response)

Multi-Gateway Example

from paybridge import PayBridge

paystack = PayBridge(provider="paystack", secret_key="PAYSTACK_SECRET")
flutterwave = PayBridge(provider="flutterwave", secret_key="FLUTTERWAVE_SECRET")

try:
    response = paystack.initialize_payment(amount=5000, email="customer@example.com")
except Exception:
    response = flutterwave.initialize_payment(amount=5000, email="customer@example.com")
print(response)

Supported Providers

  • Paystack
  • Flutterwave
  • Monnify (in progress)
  • Stripe (planned)

Environment Variables

Never hardcode secret keys in production. Use a .env file:

PAYSTACK_SECRET_KEY=sk_test_xxxxx
FLUTTERWAVE_SECRET_KEY=FLWSECK_TEST_xxxxx

And load with python-dotenv:

from dotenv import load_dotenv
import os
load_dotenv()
secret_key = os.getenv("PAYSTACK_SECRET_KEY")

FastAPI Example

from fastapi import FastAPI
from paybridge import PayBridge

app = FastAPI()
paybridge = PayBridge(provider="paystack", secret_key="sk_test_xxxxxxxxx")

@app.post("/initialize-payment")
async def initialize_payment():
    response = paybridge.initialize_payment(
        amount=5000,
        email="customer@example.com",
        currency="NGN",
        reference="TXN_001"
    )
    return response

Error Handling Example

try:
    response = paybridge.initialize_payment(amount=5000, email="customer@example.com")
    print(response)
except Exception as e:
    print(f"Payment failed: {e}")

License

MIT License

Metadata

Release files for paybridge 0.1.4

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

Source distribution (sdist)

Source distribution for paybridge 0.1.4
File Size Uploaded Provenance Actions
paybridge-0.1.4.tar.gz 23.5 kB Without provenance Details for paybridge-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paybridge 0.1.4
File Interpreter ABI Platform Actions
paybridge-0.1.4-py3-none-any.whl Python 3 none any Details for paybridge-0.1.4-py3-none-any.whl

Total release size: 54.9 kB

Release files / paybridge-0.1.4.tar.gz

Download URL paybridge-0.1.4.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
702570ad50ca7cf94562680f11162ecfe6bbfb60617960701b6f161062415967
BLAKE2b-256 checksum
How to use checksums
d6aef8a49837dcbd382760470bc39d5115d23f6da0fe916260765a5a3b8622bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / paybridge-0.1.4-py3-none-any.whl

Download URL paybridge-0.1.4-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d7ccbc77a1e17a6012a1b15f64dcbb5fc0a39457fceddc577c913bd20f83df0
BLAKE2b-256 checksum
How to use checksums
0ee6b47031d7cfbe54dcd09a7d17eb6729c3995109fbeb1220f7a5bad7f2cc9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for paybridge 0.1.4

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