Future<> — and fits naturally into your widgets and services.
Installation
Add the dependency to yourpubspec.yaml:
pubspec.yaml
Initialization
Dart
apikey and authToken from the LigdiCash dashboard by creating an API project. Store them in environment variables, never hardcoded in your Flutter code.
Hosted payin
The customer is redirected to the LigdiCash-hosted payment page inside a WebView. This is the recommended mobile flow.Dart
Direct payin
The customer pays directly from your Flutter interface. You must collect their phone number and, depending on the operator, their OTP code.Dart
The OTP mode varies by operator. For example, with a USSD operator, the customer generates the OTP on their phone before you submit. For an approval-mode operator (e.g. Moov Africa), send
otp: '' — the customer approves directly in their app. See the operator page for details.Payout
Send money to a customer — refund, payout, salary.To the customer’s LigdiCash wallet
Dart
Directly to mobile money
Dart
WithdrawalType.client uses POST /pay/v01/withdrawal/create (via the LigdiCash wallet). WithdrawalType.merchant uses POST /pay/v01/straight/payout (direct mobile money, slower). See Payout — Introduction.Status verification
CallgetTransaction with the token stored at creation (not the callback token, which is different).
Dart
TransactionType values:
| Value | Endpoint checked |
|---|---|
TransactionType.payin | GET /redirect/checkout-invoice/confirm |
TransactionType.clientPayout | GET /withdrawal/confirm |
transaction:
| Property | Type | Description |
|---|---|---|
status | String | "completed", "pending", "cancelled" |
responseCode | String | "00" success, "01" failure |
amount | double | Transaction amount |
operatorId | String | Operator identifier |
operatorName | String | Operator name |
customer | String | Customer phone number |
token | String | Transaction token |
customData | Map<String, dynamic> | Custom data sent at creation |
Error handling
Dart
Check
response.responseCode after every call: "00" indicates success, "01" an error. On error, read response.wiki to get the URL with sub-code details.