async/await). TypeScript types are bundled with the package.
Installation
cross-fetch dependency is installed automatically.
Initialization
apiKey and authToken from the LigdiCash dashboard by creating an API project.
Hosted payin
The customer is redirected to the LigdiCash-hosted payment page. This is the recommended flow for online stores.TypeScript
Direct payin
The customer pays directly from your interface. You must collect their phone number and, depending on the operator, their OTP code.TypeScript
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, salary, payout.To the customer’s LigdiCash wallet
TypeScript
Directly to mobile money
TypeScript
type: "client" uses POST /pay/v01/withdrawal/create (via the LigdiCash wallet). type: "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).
TypeScript
transaction:
TypeScript types
The SDK exports the following types for your function signatures and interfaces:TypeScript
Error handling
TypeScript
Also check
response.response_code after every call: "00" indicates success, "01" an error. On error, read response.wiki to get the URL with sub-code details.