Skip to main content
Version: 1.0

Library Usage — Account

Account APIs retrieve subscriber information and validate account status. They are shared across all product types (Collection, Disbursements, Remittance) — pass the appropriate productType and productSubscriptionKey for the product you are using.


Get Account Balance

Returns the current balance of the product wallet.

defaultRepository.getAccountBalance(
productType = ProductType.COLLECTION.productType,
apiVersion = "v1_0",
currency = null, // null returns balance in the account's default currency
productSubscriptionKey = collectionPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> {
val balance = result.response
// balance.availableBalance, balance.currency
}
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}

Pass a specific ISO-4217 currency code to currency to retrieve the balance in that currency:

defaultRepository.getAccountBalance(
productType = ProductType.REMITTANCE.productType,
apiVersion = "v1_0",
currency = "EUR",
productSubscriptionKey = remittancePrimaryKey,
environment = "sandbox"
).collect { result -> /* ... */ }
ParameterTypeDescription
productTypeStringProduct type string
apiVersionStringAPI version, e.g. "v1_0"
currencyString?ISO-4217 currency code, or null for the default currency
productSubscriptionKeyStringPrimary subscription key for the product
environmentString"sandbox" or "production"

Get Basic User Info

Retrieves the name and other non-sensitive profile fields for a given account holder without requiring the subscriber's consent.

defaultRepository.getBasicUserInfo(
productType = ProductType.COLLECTION.productType,
apiVersion = "v1_0",
accountHolder = "256770000000", // MSISDN
productSubscriptionKey = collectionPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> {
val info = result.response
// info.name, info.givenName, info.familyName, etc.
}
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
productTypeStringProduct type string
apiVersionStringAPI version
accountHolderStringMSISDN of the account holder
productSubscriptionKeyStringPrimary subscription key
environmentString"sandbox" or "production"

Retrieves full profile information for the authenticated subscriber. Requires a valid OAuth2 access token (the subscriber must have approved via the CIBA flow).

defaultRepository.getUserInfoWithConsent(
productType = ProductType.COLLECTION.productType,
apiVersion = "v1_0",
productSubscriptionKey = collectionPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> {
val info = result.response
// info.sub, info.name, info.phoneNumber, info.email, etc.
}
is NetworkResult.Error -> { /* failed */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
productTypeStringProduct type string
apiVersionStringAPI version
productSubscriptionKeyStringPrimary subscription key
environmentString"sandbox" or "production"

Validate Account Holder Status

Checks whether a given account holder is registered and active on the MTN MoMo platform.

defaultRepository.validateAccountHolderStatus(
productType = ProductType.COLLECTION.productType,
apiVersion = "v1_0",
accountHolder = AccountHolder(partyIdType = "MSISDN", partyId = "256770000000"),
productSubscriptionKey = collectionPrimaryKey,
environment = "sandbox"
).collect { result ->
when (result) {
is NetworkResult.Success -> { /* account is active */ }
is NetworkResult.Error -> { /* account not found or inactive */ }
is NetworkResult.Loading -> { /* in progress */ }
}
}
ParameterTypeDescription
productTypeStringProduct type string
apiVersionStringAPI version
accountHolderAccountHolderAccount identifier — partyIdType is typically "MSISDN"
productSubscriptionKeyStringPrimary subscription key
environmentString"sandbox" or "production"