PawaPay Python SDK โ Easily integrate, accept, and manage mobile money payments across Africa.
# PawaPay Python SDK
A comprehensive Python SDK for integrating with the PawaPay mobile money payment platform across Africa.
## Features
- **Deposits**: Request payments from customers
- **Payouts**: Send payments to recipients
- **Payment Pages**: Create hosted payment pages
- **Webhook Support**: Handle real-time payment notifications
- **Correspondent Prediction**: Automatically detect mobile money operators
- **Comprehensive Validation**: Built-in validation for phone numbers, amounts, and currencies
- **Error Handling**: Detailed error handling and exceptions
- **Async Support**: Built for asynchronous operations with proper polling
- **Type Safety**: Full type hints and data classes
## Supported Countries & Currencies
- ๐ฌ๐ญ Ghana (GHS)
- ๐ฐ๐ช Kenya (KES)
- ๐บ๐ฌ Uganda (UGX)
- ๐น๐ฟ Tanzania (TZS)
- ๐ท๐ผ Rwanda (RWF)
- ๐จ๐ฎ Ivory Coast (XOF)
- ๐จ๐ฒ Cameroon (XAF)
- ๐ฟ๐ฒ Zambia (ZMW)
- ๐ฒ๐ผ Malawi (MWK)
## Installation
```bash
pip install pawapay-python
```
## Quick Start
### 1. Environment Setup
Create a `.env` file:
```env
PAWAPAY_API_TOKEN=your_api_token_here
PAWAPAY_ENVIRONMENT=sandbox
PAWAPAY_CALLBACK_URL=
your-app.com
PAWAPAY_CALLBACK_SECRET=your_webhook_secret
```
### 2. Basic Usage
```python
from pawapay import create_client
from pawapay.exceptions import PawaPayException
# Create client from environment variables
client = create_client()
# Request a deposit (customer pays you)
try:
deposit = client.request_deposit(
amount="100.00",
currency="KES",
phone_number="254700000001",
statement_description="Payment for order #123"
)
print(f"Deposit ID: {deposit.deposit_id}")
print(f"Status: {deposit.status.value}")
except PawaPayException as e:
print(f"Error: {e}")
```
### 3. Advanced Usage
```python
from pawapay import PawaPayClient, PawaPayConfig
from pawapay.models import TransactionStatus
from pawapay.utils import PawaPayValidator, PawaPayHelper
# Manual configuration
config = PawaPayConfig(
api_token="your_token",
base_url="https: โฆ