Metadata-Version: 2.4
Name: paynexus-gateway
Version: 1.0.1
Summary: Simple PayNexus Gateway Python SDK for M-Pesa payments
Author-email: PayNexus <support@paynexus.co.ke>
License-Expression: MIT
Project-URL: Homepage, https://www.paynexus.co.ke
Project-URL: Repository, https://github.com/MCBANKSKE/paynexus-python-sdk
Project-URL: Issues, https://github.com/MCBANKSKE/paynexus-python-sdk/issues
Keywords: paynexus-gateway,paynexus,mpesa,stk-push,payment,kenya,mobile-money,m-pesa,safaricom
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: respx>=0.20; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# PayNexus Gateway Python SDK

Simple Python SDK for PayNexus M-Pesa payments.

## Installation

```bash
pip install paynexus-gateway
```

Requires Python 3.9 or later.

## Usage

```python
from paynexus_gateway import PayNexusClient

client = PayNexusClient("sk_your_secret_key_here")

payment = client.initiate_payment(
    amount=100,
    phone="0746990866",
    description="Order #12345",
)

reference = payment["data"]["reference"]
status = client.get_payment_status(reference)
```

## Methods

### Initiate payment

```python
payment = client.initiate_payment(
    amount=100,
    phone="0746990866",
    description="Order #12345",
)
```

The API auto-normalizes the phone number and uses your default M-Pesa payment account.

### Validate phone

```python
result = client.validate_phone("0746990866")
```

### Get payment status by reference

```python
status = client.get_payment_status("PNXABC123")
```

### Get payment status by CheckoutRequestID

```python
status = client.get_payment_status_by_checkout_id("ws_CO_123456")
```

## Error handling

```python
from paynexus_gateway import PayNexusClient, PayNexusError

client = PayNexusClient("sk_your_secret_key_here")

try:
    client.initiate_payment(100, "0746990866", "Order #12345")
except PayNexusError as exc:
    print(exc.status, exc.code, exc.errors)
```

## License

MIT
