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

NameTypeDescription
LibLiteActivity.IN_API_KEYStringThis 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_SYSTEMStringThis value can be “LIVE” or “TEST”, representing the
Scan to Pay backend system to connect to.
LibLiteActivity.IN_SUGGESTED_MSISDNStringThis 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 CodeDescriptionExtra Values
LibLiteActivity.LIBLITE_ERRORReturned if an error has occurred before the paymentLibLiteActivity.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_CANCELLEDReturned if the user aborted the processLibLiteActivity.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_SUCCESSReturned 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.