Core Concepts
This SDK follows a clean, layered architecture with DI and clear error semantics.
Dependency Injection
- Uses
get_it
andinjectable
to wire repositories and services. - Initialize once with
MindPaystack.init(config)
. Services are resolved with the samePaystackConfig
.
final paystack = MindPaystack.instance;
final txService = paystack.transaction; // TransactionService
final chargeService = paystack.charge; // ChargeService
final pmService = paystack.paymentMethods; // PaymentMethodService
final channelService = paystack.paymentChannel; // PaymentChannelService
Networking
- Built on
dio
with interceptors:- Request enrichment: request IDs, idempotency, SDK metadata, environment
- Authentication: Bearer header (uses secret key by default)
- Retry: exponential backoff and jitter
- Error mapping: converts Dio errors to
MindException
- Logging: structured logs configurable by
LogLevel
Errors
All SDK methods throw MindException
with:
message
,code
category
(network, authentication, validation, server, unknown)severity
(info, warning, error, fatal)metadata
(requestId, statusCode, url, etc.)
try {
await paystack.transaction.verifyTransaction('ref');
} on MindException catch (e) {
// e.category, e.isRetriable, e.displayMessage
}
Amounts and currency
- Amounts are in the lowest denomination (e.g., kobo for NGN).
- Default currency is
NGN
; override per call or via config.
Models and typing
Responses are strongly typed using freezed
data models across features.
Last updated on