Mpesa
constructor(consumerKey: String, consumerSecret: String, environment: Environment = Environment.SANDBOX, shouldEnableLogging: Boolean = environment == Environment.SANDBOX, httpClientEngine: HttpClientEngine? = null, cache: Cache<Long, AccessToken> = Cache.Builder<Long, AccessToken>().build(), httpClientConfig: HttpClientConfig<*>.() -> Unit = {
commonKtorConfiguration(
consumerKey,
consumerSecret,
environment,
shouldEnableLogging,
cache
).invoke(this)
}, httpClient: HttpClient = createHttpClient(httpClientEngine, httpClientConfig))
Parameters
consumerKey
Daraja API consumer key.
consumerSecret
Daraja API consumer secret.
environment
The Environment of the API. Defaults to Environment.SANDBOX.
shouldEnableLogging
Boolean value indicating whether to enable logging. Defaults to true if the environment is Environment.SANDBOX, false otherwise.
httpClientEngine
The HTTP client engine to use. Defaults to null, which uses the default engine for the current platform.
cache
A cache to store access tokens. Defaults to a new Cache instance.
httpClientConfig
A lambda expression that configures the HTTP client. Defaults to a configuration that uses the provided consumer key, consumer secret, environment, and logging settings.
httpClient
The HTTP client to use. Defaults to a new client configured with the provided configuration.