Skip to content

Remit SDK for Android

The Remit SDK is a solution to ease the integration with the Alviere services.

Features

  • Beneficiary Management
  • Global Payments
  • Cash-pickup
  • Payout Methods

Requirements

  • Android Studio Hedgehog or above
  • Android 6.0 (API level 23) or above
  • Java 11+

Installation

Maven Central

1. Add Maven Central to project repositories

repositories {
    // ...
    mavenCentral()
}

2. Add SDK dependency to module's build.gradle file using the latest version.

dependencies {
    // ...
    implementation 'com.alviere.android:remit:X.Y.Z'
}

Manual

1. Get the latest version of Remit SDK provided by Alviere and add the files to your .m2 path location. Depending on your operation system, these are the default paths.

  • Windows: C:\Users\<User_Name>\.m2
  • Linux: /home/<User_Name>/.m2
  • Mac: /Users/<user_name>/.m2

2. Add a maven path to include the .m2 path location in project repositories. Add the new path before mavenCentral() to respect fetch order.

repositories {
    // ...
    maven { url "file:/path/to/repo/m2repository/" } // Or use mavenLocal() for default path.
    mavenCentral()
}

3. Add SDK dependency to module's build.gradle file using the version provided by Alviere.

dependencies {
    // ...
    implementation 'com.alviere.android:remit:X.Y.Z'
}

Java Version Support

Make sure you have enabled Java 11 language feature support. To do so, guarantee that the following configurations are on the module's build.gradle file.

android {
    // ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }
}

Usage

On your android application class, setup Alviere Initialization.

class AndroidApplication : Application() {

  override fun onCreate() {
    super.onCreate()

    Alviere.init(this)
  }
}

Beneficiary Management

This section outlines the integration with Alviere to manage beneficiaries. To start, get the RemitSdk service interface instance or use with Dependency Injection.

private val remitService = RemitSdk.service

Declare the callback

These callbacks are the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val createBeneficiarySdkCallback = object : CreateBeneficiarySdkCallback {
  override fun onSuccess(beneficiary: BeneficiaryDetailsModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val listBeneficiariesSdkCallback = object : ListBeneficiariesSdkCallback {
  override fun onSuccess(beneficiaries: List<BeneficiaryDetailsModel>) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val getBeneficiarySdkCallback = object : GetBeneficiarySdkCallback {
  override fun onSuccess(beneficiary: BeneficiaryDetailsModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val updateBeneficiarySdkCallback = object : UpdateBeneficiarySdkCallback {
  override fun onSuccess(beneficiary: BeneficiaryDetailsModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val deleteBeneficiarySdkCallback = object : DeleteBeneficiarySdkCallback {
  override fun onSuccess() { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

onSuccess

This callback method is called when a beneficiary request was successfully executed. Use this to manage beneficiaries of an account with the Alviere API.

onEvent

This callback method is called when the user exited from the Remit SDK, when an error occurred, or when certain events in the Remit SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Remit SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

Create Beneficiary

To create a beneficiary, use the Remit SDK service method remitService.createBeneficiary. Pass the session_token, the account_uuid, the BeneficiaryRequest model and the CreateBeneficiarySdkCallback.

val model = BeneficiaryRequest(...)
remitService.createBeneficiary(
    token = session_token,
    accountUuid = account_uuid,
    data = model,
    clientCallback = createBeneficiarySdkCallback
)

The result of this action will return the newly created BeneficiaryDetailsModel on onSuccess(beneficiary: BeneficiaryDetailsModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

List Beneficiaries

To get a list of beneficiaries from an account, use the Remit SDK service method remitService.listBeneficiaries. Pass the session_token, the account_uuid, the ListBeneficiariesSdkCallback and the limit/offset/type optionally.

remitService.listBeneficiaries(
    token = session_token,
    accountUuid = account_uuid,
    clientCallback = listBeneficiariesSdkCallback
)

The result of this action will return the account's beneficiaries List<BeneficiaryDetailsModel> on onSuccess(beneficiaries: List<BeneficiaryDetailsModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get Beneficiary

To get a beneficiary, use the Remit SDK service method remitService.getBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid and the GetBeneficiarySdkCallback.

remitService.getBeneficiary(
    token = session_token,
    accountUuid = account_uuid,
    beneficiaryUuid = beneficiary_uuid,
    clientCallback = getBeneficiarySdkCallback
)

The result of this action will return the beneficiary of an account BeneficiaryDetailsModel on onSuccess(beneficiary: BeneficiaryDetailsModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update Beneficiary

To update a beneficiary, use the Remit SDK service method remitService.updateBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid, the BeneficiaryUpdateRequest model to be updated and the UpdateBeneficiarySdkCallback.

val beneficiaryDetails = BeneficiaryUpdateRequest(...)
remitService.updateBeneficiary(
    sessionToken = session_token,
    accountUuid = account_uuid,
    beneficiaryUuid = beneficiary_uuid,
    data = beneficiaryDetails,
    clientCallback = updateBeneficiarySdkCallback
)

The result of this action will return the updated beneficiary BeneficiaryDetailsModel on onSuccess(beneficiary: BeneficiaryDetailsModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Delete Beneficiary

To delete a beneficiary, use the Remit SDK service method remitService.deleteBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid and the DeleteBeneficiarySdkCallback.

remitService.deleteBeneficiary(
    sessionToken = session_token,
    accountUuid = account_uuid,
    beneficiaryUuid = beneficiary_uuid,
    clientCallback = deleteBeneficiarySdkCallback
)

The result of this action will return on onSuccess() and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Global Payments

This section outlines the integration with Alviere to manage global payments. To start, get the RemitSdk service interface instance or use with Dependency Injection.

private val remitService = RemitSdk.service

Declare the callback

These callbacks are the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val createQuoteSdkCallback = object : CreateQuoteSdkCallback {
  override fun onSuccess(quoteDetails: QuoteDetailsModel) { /* handle event */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val createRemittanceSdkCallback = object : CreateRemittanceSdkCallback {
  override fun onSuccess(remittance: RemittanceModel) { /* handle event */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

onSuccess

This callback method is called when a related global payments request was successfully executed. Use this to manage beneficiaries global payments of an user's wallet with the Alviere API.

onEvent

This callback method is called when the user exited from the Remit SDK, when an error occurred, or when certain events in the Remit SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Remit SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

Create Quote

To create a quote, use the Remit SDK service method remitService.createQuote. Pass the session_token, the wallet_uuid, the QuoteRequest model and the CreateQuoteSdkCallback.

val model = QuoteRequest(...)
remitService.createQuote(
    token = session_token,
    walletUuid = wallet_uuid,
    data = model,
    clientCallback = createQuoteSdkCallback
)

The result of this action will return the newly created QuoteDetailsModel on onSuccess(quoteDetails: QuoteDetailsModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Create Remittance

To create a remittance transaction, use the Remit SDK service method remitService.createRemittance. Pass the session_token, the wallet_uuid, the RemittanceRequest model and the CreateRemittanceSdkCallback.

val model = RemittanceRequest(...)
remitService.createRemittance(
    token = session_token,
    walletUuid = wallet_uuid,
    data = model,
    clientCallback = createRemittanceSdkCallback
)

The result of this action will return the newly created RemittanceModel on onSuccess(remittance: RemittanceModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Cash-pickup

This section outlines the integration with Alviere to manage cash-pickup. To start, get the RemitSdk service interface instance or use with Dependency Injection.

private val remitService = RemitSdk.service

Declare the callback

These callbacks are the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val listCashPickupCitiesSdkCallback = object : ListCashPickupCitiesSdkCallback {
  override fun onSuccess(cities: List<CashPickupCityModel>) {

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val listCashPickupLocationsSdkCallback = object : ListCashPickupLocationsSdkCallback {
  override fun onSuccess(locations: List<CashPickupLocationModel>) {

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val getCashPickupLocationSdkCallback = object : GetCashPickupLocationSdkCallback {
  override fun onSuccess(cashPickupLocation: CashPickupLocationModel) {

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

onSuccess

This callback method is called when a related cash-pickup request was successfully executed. Use this to manage cash-pickup with the Alviere API.

onEvent

This callback method is called when the user exited from the Remit SDK, when an error occurred, or when certain events in the Remit SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Remit SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

List Cash-pickup cities

To get a list of cash-pickup cities, use the Remit SDK service method remitService.listCashPickupCities. Pass the session_token, the ListCashPickupCitiesSdkCallback and the country/state/city optionally.

remitService.listCashPickupCities(
    token = session_token,
    clientCallback = listCashPickupCitiesSdkCallback
)

The result of this action will return the list of cash-pickup cities List<CashPickupCityModel> on onSuccess(cities: List<CashPickupCityModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

List Cash-pickup locations

To get a list of cash-pickup locations, use the Remit SDK service method remitService.listCashPickupLocations. Pass the session_token, the, city_uuid, the listCashPickupLocationsSdkCallback and the network optionally.

remitService.listCashPickupLocations(
    token = session_token,
    cityUuid = city_uuid,
    clientCallback = listCashPickupCitiesSdkCallback
)

The result of this action will return the list of cash-pickup locations List<CashPickupLocationModel> on onSuccess(locations: List<CashPickupLocationModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get Cash-pickup location

To get a cash-pickup location, use the Remit SDK service method remitService.getCashPickupLocation. Pass the session_token, the cash_pickup_location_uuid and the GetCashPickupLocationSdkCallback.

remitService.getCashPickupLocation(
    token = session_token,
    cashPickupLocationUuid = cash_pickup_location_uuid,
    clientCallback = getCashPickupLocationSdkCallback
)

The result of this action will return the cash-pickup location CashPickupLocationModel on onSuccess(cashPickupLocation: CashPickupLocationModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Payout Methods

This section outlines the integration with Alviere to manage payout methods from beneficiaries. To start, get the RemitSdk service interface instance or use with Dependency Injection.

private val remitService = RemitSdk.service

Declare the callback

These callbacks are the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val createPayoutMethodSdkCallback = object : CreatePayoutMethodSdkCallback {
  override fun onSuccess(payoutMethod: PayoutMethodModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val listPayoutMethodsSdkCallback = object : ListPayoutMethodsSdkCallback {
  override fun onSuccess(payoutMethods: List<PayoutMethodModel>) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val getPayoutMethodSdkCallback = object : GetPayoutMethodSdkCallback {
  override fun onSuccess(payoutMethod: PayoutMethodModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val updatePayoutMethodSdkCallback = object : UpdatePayoutMethodSdkCallback {
  override fun onSuccess(payoutMethod: PayoutMethodDetailsModel) { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

private val deletePayoutMethodSdkCallback = object : DeletePayoutMethodSdkCallback {
  override fun onSuccess() { /* handle success */ }

  override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}

onSuccess

This callback method is called when a payout method request was successfully executed. Use this to manage payout methods of a beneficiary with the Alviere API.

onEvent

This callback method is called when the user exited from the Remit SDK, when an error occurred, or when certain events in the Remit SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Remit SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

Create Payment Method

To create a payment method, use the Remit SDK service method remitService.createPayoutMethod. Pass the session_token, the beneficiary_uuid, the PayoutMethodRequest model and the CreatePayoutMethodSdkCallback.

val model = PayoutMethodRequest(...)
remitService.createPayoutMethod(
    token = session_token,
    beneficiaryUuid = beneficiary_uuid,
    data = model,
    clientCallback = createPayoutMethodSdkCallback
)

The result of this action will return the newly created PayoutMethodModel on onSuccess(payoutMethod: PayoutMethodModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

List Payment Methods

To get a list of payout methods from a beneficiary, use the Remit SDK service method remitService.listPayoutMethods. Pass the session_token, the beneficiary_uuid, the ListPayoutMethodsSdkCallback and the limit/offset optionally.

remitService.listBeneficiaries(
    token = session_token,
    beneficiaryUuid = beneficiary_uuid,
    clientCallback = listPayoutMethodsSdkCallback
)

The result of this action will return the beneficiary payout methods List<PayoutMethodModel> on onSuccess(payoutMethods: List<PayoutMethodModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get Payment Method

To get a payout method, use the Remit SDK service method remitService.getPayoutMethod. Pass the session_token, the payout_method_uuid and the GetPayoutMethodSdkCallback.

remitService.getPayoutMethod(
    token = session_token,
    payoutMethodUuid = payout_method_uuid,
    clientCallback = getPayoutMethodSdkCallback
)

The result of this action will return the payout method PayoutMethodModel on onSuccess(payoutMethod: PayoutMethodModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update Payout Method

To update a payout method, use the Remit SDK service method remitService.updatePayoutMethod. Pass the session_token, the payout_method_uuid the PayoutMethodUpdateRequest model to be updated and the UpdatePayoutMethodSdkCallback.

val model = PayoutMethodUpdateRequest(...)
remitService.updatePayoutMethod(
    sessionToken = session_token,
    payoutMethodUuid = payout_method_uuid,
    data = model,
    clientCallback = updatePayoutMethodSdkCallback
)

The result of this action will return the updated beneficiary BeneficiaryDetailsModel on onSuccess(beneficiary: BeneficiaryDetailsModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Delete Payout Method

To delete a payout method, use the Remit SDK service method remitService.deletePayoutMethod. Pass the session_token, the payout_method_uuid and the DeletePayoutMethodSdkCallback.

remitService.deletePayoutMethod(
    sessionToken = session_token,
    payoutMethodUuid = payout_method_uuid,
    clientCallback = deletePayoutMethodSdkCallback
)

The result of this action will return on onSuccess() and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Alternative Usage

Optionally for every SDK callback entry function without UI, there is an alternative suspend function with the same name without callback to run inside a kotlin coroutine. Internal code will run with withContext(Dispatchers.IO) and will return an object of type Response<T>.

val response = ...
when (response) {
  is Response.Success -> { response.data }
  is Response.Error -> { response.metadata }
}