Skip to main content

Official DigiPay Python SDK — Accept Mobile Money payments, query transactions, manage payouts.

Project description

DigiPay Python SDK

Official Python SDK for the DigiPay Mobile Money payment gateway.

Installation

pip install digipay-python

Quick Start

from digipay import DigiPay

client = DigiPay(api_key="dpk_YOUR_API_KEY")
# or set env var: export DIGIPAY_API_KEY=dpk_... then call DigiPay()

# 1. Check your balance
balance = client.settlements.get_balance()
print(f"Balance: {balance['balance']:,} XAF")

# 2. Initiate a pay-in (customer receives Mobile Money push notification)
payin = client.payments.initiate(
    amount=5000,
    customer_phone="237699000000",
    customer_email="customer@example.com",
    metadata={"order_id": "ORDER_123"},
    webhook_url="https://your-domain.com/webhook",
)
print(payin["transaction_id"])  # TXN_...
print(payin["status"])          # "pending"

# 3. Check status later
txn = client.payments.get_status(payin["transaction_id"])
print(txn["status"])  # "pending" | "success" | "failed"

# 4. Withdraw funds
payout = client.settlements.request_payout(
    amount=10000,
    recipient_phone="237699000000",
)
print(payout["settlement_id"])

Error Handling

from digipay import DigiPay, DigiPayError

client = DigiPay(api_key="dpk_...")

try:
    payin = client.payments.initiate(amount=5000, customer_phone="237699000000")
except DigiPayError as e:
    print(f"Error: {e}")
    print(f"HTTP status: {e.status_code}")

License

MIT

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

digipay_python-1.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

digipay_python-1.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file digipay_python-1.0.0.tar.gz.

File metadata

  • Download URL: digipay_python-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for digipay_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 44970a0772fff913c76412af4ceb5fcb6e7e95330a219179f5151eb4e43ee315
MD5 d372bef0a3aacc75a0579aab477aa28e
BLAKE2b-256 5a776f29e721138e0a680ae1d557a34b7f46c4ae008465362cddcb9d11310944

See more details on using hashes here.

File details

Details for the file digipay_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: digipay_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for digipay_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e977c61def25bc7d865a12a84ef939137cdd21888aa1f9c4ef21c03b4d40d10f
MD5 31b9ea6d1becdd16bbaa8574b5fd922a
BLAKE2b-256 f540ea0fd0d92476f0fb47fd4c57e1c6e4e053e02a4d0400afc962f4ccfd2140

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