Skip to main content
Version: 1.0

Library Usage — Disbursements

Disbursements APIs let you send money to Mobile Money accounts, query transfer status, issue cash transfers, and send delivery notifications.

All flows require a valid Bearer access token stored in CredentialStorage.


Transfer

Sends money from your account to a recipient's Mobile Money account.

defaultRepository.transfer(
productType = ProductType.DISBURSEMENT.productType,
apiVersion = "v1_0",
momoTransaction = MomoTransaction(
amount = "250",
currency = "EUR",
externalId = UUID.randomUUID().toString(),
payee = AccountHolder(partyIdType = "MSISDN", partyId = "256770000000"),
payerMessage = "Salary payment",
payeeNote = "March salary"
),
uuid = UUID.randomUUID().toString(),
productSubscriptionKey = disbursementsPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> { /* transfer initiated */ }
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
productTypeStringProduct type string, e.g. ProductType.DISBURSEMENT.productType
apiVersionStringAPI version, e.g. "v1_0"
momoTransactionMomoTransactionTransfer details (amount, currency, payee, messages)
uuidStringUnique reference ID — save this to poll for status
productSubscriptionKeyStringDisbursements primary subscription key
environmentString"sandbox" or "production"

Get Transfer Status

Retrieves the status of a previously initiated transfer.

defaultRepository.getTransferStatus(
productType = ProductType.DISBURSEMENT.productType,
apiVersion = "v1_0",
referenceId = transferUuid,
productSubscriptionKey = disbursementsPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> { /* parse result.response */ }
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
productTypeStringProduct type string
apiVersionStringAPI version
referenceIdStringUUID used when calling transfer
productSubscriptionKeyStringDisbursements primary subscription key
environmentString"sandbox" or "production"

Deposit

Credits a Mobile Money account directly (agent-initiated flow).

val transactionUuid = UUID.randomUUID().toString()

val result = defaultRepository.deposit(
accessToken = credentialStorage.getAccessToken(),
momoTransaction = MomoTransaction(
amount = "100",
currency = "EUR",
externalId = UUID.randomUUID().toString(),
payee = AccountHolder(partyIdType = "MSISDN", partyId = "256770000000"),
payerMessage = "Cash deposit",
payeeNote = "Deposit"
),
apiVersion = "v1_0",
productSubscriptionKey = disbursementsPrimaryKey,
uuid = transactionUuid
)
// result is a Retrofit Response<Unit>; check result.isSuccessful
ParameterTypeDescription
accessTokenStringBearer access token
momoTransactionMomoTransactionDeposit details
apiVersionStringAPI version, e.g. "v1_0"
productSubscriptionKeyStringDisbursements primary subscription key
uuidStringUnique reference ID

Get Deposit Status

Retrieves the status of a deposit.

val response = defaultRepository.getDepositStatus(
referenceId = transactionUuid,
apiVersion = "v1_0",
productSubscriptionKey = disbursementsPrimaryKey,
accessToken = credentialStorage.getAccessToken()
)
ParameterTypeDescription
referenceIdStringUUID used when calling deposit
apiVersionStringAPI version
productSubscriptionKeyStringDisbursements primary subscription key
accessTokenStringBearer access token

Refund

Reverses a previously completed disbursements transaction.

val refundUuid = UUID.randomUUID().toString()

val result = defaultRepository.refund(
accessToken = credentialStorage.getAccessToken(),
momoTransaction = MomoTransaction(
amount = "100",
currency = "EUR",
externalId = UUID.randomUUID().toString(),
payerMessage = "Refund for order #42",
payeeNote = "Refund",
referenceIdToRefund = originalTransactionUuid
),
apiVersion = "v2_0",
productSubscriptionKey = disbursementsPrimaryKey,
uuid = refundUuid
)
ParameterTypeDescription
accessTokenStringBearer access token
momoTransactionMomoTransactionRefund details; set referenceIdToRefund to the original transaction UUID
apiVersionStringAPI version, e.g. "v2_0"
productSubscriptionKeyStringDisbursements primary subscription key
uuidStringUnique reference ID for this refund

Get Refund Status

Retrieves the status of a refund.

val response = defaultRepository.getRefundStatus(
referenceId = refundUuid,
apiVersion = "v2_0",
productSubscriptionKey = disbursementsPrimaryKey,
accessToken = credentialStorage.getAccessToken()
)
ParameterTypeDescription
referenceIdStringUUID used when calling refund
apiVersionStringAPI version
productSubscriptionKeyStringDisbursements primary subscription key
accessTokenStringBearer access token

Cash Transfer

Initiates a cash transfer (over-the-counter disbursement).

defaultRepository.cashTransfer(
apiVersion = "v1_0",
cashTransfer = CashTransfer(
amount = "300",
currency = "EUR",
externalId = UUID.randomUUID().toString(),
payerIdentity = "256770000000",
payeeIdentity = "256770000001",
payerMessage = "Cash transfer",
payeeNote = "Transfer"
),
uuid = UUID.randomUUID().toString(),
productSubscriptionKey = disbursementsPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> { /* transfer initiated */ }
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
apiVersionStringAPI version
cashTransferCashTransferTransfer details including payer and payee identities
uuidStringUnique reference ID
productSubscriptionKeyStringDisbursements primary subscription key
environmentString"sandbox" or "production"

Get Cash Transfer Status

Retrieves the status of a cash transfer.

defaultRepository.getCashTransferStatus(
apiVersion = "v1_0",
referenceId = cashTransferUuid,
productSubscriptionKey = disbursementsPrimaryKey,
environment = "sandbox"
).collect { result -> /* ... */ }
ParameterTypeDescription
apiVersionStringAPI version
referenceIdStringUUID used when calling cashTransfer
productSubscriptionKeyStringDisbursements primary subscription key
environmentString"sandbox" or "production"

Request to Withdraw Delivery Notification

Sends a delivery notification after a withdrawal has been processed.

defaultRepository.requestToWithdrawDeliveryNotification(
apiVersion = "v1_0",
referenceId = withdrawalUuid,
momoNotification = MomoNotification(notificationMessage = "Your withdrawal has been processed."),
productSubscriptionKey = disbursementsPrimaryKey,
environment = "sandbox"
).collect { result -> /* ... */ }
ParameterTypeDescription
apiVersionStringAPI version
referenceIdStringUUID of the original withdrawal
momoNotificationMomoNotificationNotification message body
productSubscriptionKeyStringDisbursements primary subscription key
environmentString"sandbox" or "production"