Metadata-Version: 2.4
Name: digipay-python
Version: 1.0.0
Summary: Official DigiPay Python SDK — Accept Mobile Money payments, query transactions, manage payouts.
Author-email: DigiPay <support@digitalcertify.tech>
License: MIT
Project-URL: Homepage, https://digitalcertify.tech/v1/api/
Project-URL: Repository, https://github.com/digipay/digipay-python
Keywords: digipay,payment,mobile-money,mtn,orange,cameroon,africa
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Dynamic: license-file

# DigiPay Python SDK

Official Python SDK for the [DigiPay](https://digitalcertify.tech) Mobile Money payment gateway.

## Installation

```bash
pip install digipay-python
```

## Quick Start

```python
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

```python
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
