Android Setup¶
Installation¶
Ansa is available on mavenCentral()
.
Initialization¶
Everything in the mobile SDK is facilitated via an initialized Ansa Client.
private val ansaClient: AnsaClient =
AnsaClient.init(
publishableKey = networkType.merchantPublishableKey(),
clientSecretProvider = ClientSecretProviderImpl()
)
Initializing an instance of AnsaClient requires your merchant publishable key from onboarding as well as setting up a ClientSecretProvider
implementation.
interface ClientSecretProvider {
/**
* Provider for a short lived token for accessing customer specific endpoints.
*
* @param ansaCustomerId unique identifier for a given customer
* @return a short lived token for this customer
*/
suspend fun provideClientSecret(ansaCustomerId: String): String?
}
Logging¶
AnsaClient supports allowing you to hook up any logging internally in AnsaClient to your preferred logging framework (Timber, Kermit, LogCat, etc.) via a logging plugin during init()
.