Requesting Preregistration
This method allows a 3rd party app to “register” a user so that the checkout process will be faster. It is HIGHLY recommended that 3rd party apps DO NOT user this method unless they have a specific use case for it.
This method will also make sure a user has a card linked to his/her account.
Invoking the Preregistration Intent
The following snippet illustrates how to invoke the payment request Intent:
Intent intent = new Intent(context, LibLitePreRegActivity.class);
intent.putExtra(LibLiteActivity.IN_API_KEY, "APIKEY");
intent.putExtra(LibLiteActivity.IN_SYSTEM, "LIVE");
context.startActivityForResult(intent, 10);
Values passed to the LibLitePreRegActivity
Name | Type | Description |
---|---|---|
LibLiteActivity.IN_API_KEY | String | This is the API key provided by Oltio/UKheshe that will enable the library to be used. This can be found on the Scan to Pay Portal under the Lib Lite Tokens menu item |
LibLiteActivity.IN_SYSTEM | String | This value can be “LIVE” or “TEST”, representing the Scan to Pay backend system to connect to. |
LibLiteActivity.IN_SUGGESTED_MSISDN | String | This is an optional field if you know the clients mobile number. |
Handling the Preregistration Response
The following snippet illustrates how to handle the response from the LibLitePreRegActivity:
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{ switch (requestCode) {case 10:
if (resultCode == LibLiteActivity.LIBLITE_ERROR) { int error_code =
data.getIntExtra(LibLiteActivity.OUT_ERROR_CODE, -1); int
location = data.getIntExtra(LibLiteActivity.OUT_LOCATION, -1);
} else if (resultCode == LibLiteActivity.LIBLITE_PAYMENT_SUCCESS)
{ String txReference = data.getStringExtra(LibLiteActivity.OUT_TX_REFERENCE); ...
} else if (resultCode == LibLiteActivity.LIBLITE_REGISTRATION_SUCCESS)
{ boolean silent = data.getBooleanExtra(LibLiteActivity.OUT_SILENT_REGISTRATION,false);
}
break;
}
}
The following is a breakdown of resultCodes:
Result Code | Description | Extra Values |
---|---|---|
LibLiteActivity.LIBLITE_ERROR | Returned if an error has occurred before the payment | LibLiteActivity.OUT_ERROR_CODE – This indicates the type of error that occurred. See the error table below LibLiteActivity.OUT_LOCATION - This is the location of the error. This can be used to debug the error when requesting support from Oltio. |
LibLiteActivity.LIBLITE_USER_CANCELLED | Returned if the user aborted the process | LibLiteActivity.OUT_LOCATION - This is the location where the user aborted. This can be used to determine where the user is dropping off. |
LibLiteActivity.LIBLITE_REGISTRATION_SUCCESS | Returned if the user has registered with Scan to Pay and has a usable card on file. | LibLiteActivity.OUT_SILENT_REGISTRATION True: The user did not have any interaction with the library. He/she was most probably already registered False: The user has some interaction with the library. |
Updated about 2 years ago