Skip to main content
The LigdiCash Dart SDK is built for Flutter. It uses Dart conventions — named parameters, enums, Future<> — and fits naturally into your widgets and services.

Installation

Add the dependency to your pubspec.yaml:
pubspec.yaml
Then install:
Requirements: Dart SDK ≥ 3.4.1 / Flutter ≥ 3.x.

Initialization

Dart
Get your 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
On Flutter, open paymentUrl in a native WebView (webview_flutter package). Never display it in an HTML iframe-based WebView — LigdiCash blocks it.
Detect the return URL (returnUrl / cancelUrl) in the WebView’s onNavigationRequest callback to close it automatically and resume the app flow.
Always leave customer absent in hosted payin. If you pass a number, LigdiCash filters the payment page to show only the operators tied to that number.

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

Call getTransaction with the token stored at creation (not the callback token, which is different).
Dart
TransactionType values:
ValueEndpoint checked
TransactionType.payinGET /redirect/checkout-invoice/confirm
TransactionType.clientPayoutGET /withdrawal/confirm
Fields available on transaction:
PropertyTypeDescription
statusString"completed", "pending", "cancelled"
responseCodeString"00" success, "01" failure
amountdoubleTransaction amount
operatorIdStringOperator identifier
operatorNameStringOperator name
customerStringCustomer phone number
tokenStringTransaction token
customDataMap<String, dynamic>Custom data sent at creation
Never deliver an order solely based on an incoming callback. Always call getTransaction with the token stored at creation to confirm the status on the LigdiCash server side. See Callback security.

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.