ugpayments is a Flutter package that simplifies payment integrations for Uganda-based applications. It provides a unified API for Mobile Money, card payments via PesaPal, and bank transfers — supporting Android, iOS, and macOS out of the box. Built specifically for the East African fintech ecosystem, where payment fragmentation is a real problem
# ugpayments
A comprehensive Flutter package for processing payments in Uganda, supporting PesaPal integration (including card options via redirect flow) and mobile money.
## Features
- **PesaPal Integration**: Full integration with PesaPal payment gateway
- **Multiple Payment Methods**: Support for mobile money (MTN, Airtel, M-Pesa) and PesaPal (including card options via redirect flow)
- **Comprehensive Validation**: Built-in validation for payment data, phone numbers, and more
- **Security**: Encryption utilities for sensitive payment data
- **Error Handling**: Robust exception handling with detailed error messages
- **JSON Serialization**: Full support for JSON serialization/deserialization
- **Type Safety**: Strongly typed models and responses
- **Testing**: Comprehensive test coverage
## Getting started
Add the package to your `pubspec.yaml`:
```yaml
dependencies:
ugpayments: ^0.2.0
```
## Before you start (PesaPal keys)
Before using the PesaPal parts of this package, you need your Pesapal credentials from your Pesapal account:
1. Go to the Pesapal website and create/register your merchant account.
2. In your Pesapal dashboard/developer settings, obtain your API credentials:
- `consumer_key` (your "Consumer Key")
- `consumer_secret` (your "Consumer Secret")
3. Make sure you use the correct credentials for the environment:
- `PaymentConfig.pesaPalSandbox` -> your *sandbox* `consumer_key`/`consumer_secret`
- `PaymentConfig.pesaPalProduction` -> your *production* `consumer_key`/`consumer_secret`
4. Set `callbackUrl` to the URL that Pesapal will call after payment. This endpoint should be publicly reachable.
Notes:
- Keep `consumer_key` and `consumer_secret` out of source control (use environment variables or your application's secrets management in real projects).
## Usage
### Basic Setup with PesaPal
```dart
import 'package:ugpayments/ugpayments.dart';
// Create a PesaPal payment configuration
final config = PaymentConfig.pesaPalSandbox(
// Copy the …