Configuration Api (under construction)
We refer to the registration and provision of a terminal as personalisation.
When you install the PhonePOS APK or your own PhonePOS SDK implementation, the installed terminals by default are unpersonalised and need to get activated/personalised.
With a successful personalisation you will have an active terminal, i.e., a terminal that is able to process transactions.
This page will give you a short overview of the different personalisation methods that you can evaluate for personalisation.
Personalisation methods
We support multiple ways of personalising a terminal to fit different use cases.
Before choosing a personalisation method, keep in mind that some personalisation methods have prerequisites e.g., an MDM (Mobile Device management) Environment.
Getting started
Personalisation api consists of several different operations and these are all the things you will need thought the process. Before you will start the action initialisation of the terminal you will need to check status of the terminal.
To use the personalisation api, first you need to initialise the PhonePos api instance. for doing so, please take a look at the code above
class SdkLauncherViewController: UIViewController {
var phonePosApi: PhonePosApi!
override func viewDidLoad() {
super.viewDidLoad()
// Assuming PhonePosFactory and getConfigurationApi are accessible in Swift
// application id will be provided for you during the scenario
phonePosApi = PhonePosFactory.getConfigurationApi(applicationId: BuildConfig.APPLICATION_ID_FOR_PHONE_POS_APP)
// Set up any further configurations or UI elements here
}
}
Getting Terminal Status
After you get the instance of the personalisation, the status of the terminal should be checked.
In case if the terminal is already setup you don't need to do any other step and can skip this page.
Other than "already personalised" there are several responses that you can get.
class MainViewController: UIViewController {
var phonePosApi: PhonePosApi!
// ... Additional properties and methods
func retrieveStatus() {
phonePosApi.getConfigurationApi().getStatus { terminalStatus, errorMessage in
switch terminalStatus {
case .statusTerminalOperational:
// Terminal is fully functional, proceed to payments.
print("Terminal is operational.")
case .terminalNotOperational, .statusPersonalizationFailed:
// Check the reason in errorMessage.reason
if let reason = errorMessage?.reason {
switch reason {
case .batteryLow:
// Ask merchant to charge the phone
print("Battery is low, please charge the device.")
default:
// For other reasons, contact support
print("Contact support with error details.")
}
}
case .statusGeneralError:
// Communicate this case to support team
print("General error occurred. Contact support.")
case .statusAppIsOutdated:
// Prompt to update the application
print("Application is outdated. Please update.")
case .statusPersonalizationNotDoneYet:
// Can proceed to the next step for personalization
print("Personalization not done yet. Proceed to the next step.")
default:
break
}
}
}
}
In case the terminal status is statusPersonalizationNotDoneYet, you can proceed to next step to setup your terminal.
Starting the Personalisation process
At this stage you should already have checked status of the terminal and it should have shown you
that the terminal is NOT personalised yet.
The process can be started for the merchant by calling:
startPersonalisation(...) function:
class MainViewController: UIViewController {
var phonePosApi: PhonePosApi!
// ... Additional properties and methods
private func startPersonalisation() {
let provider = DataProviderFactory.chooseYourData(...) // Replace with actual parameters
phonePosApi.getConfigurationApi().startPersonalisation(provider: provider) { result, statusCode in
switch result {
case .success:
// Personalisation was successful; user can make payments
print("Personalisation succeeded. User can now make payments.")
case .failure(let personalisationResult):
// Personalisation failed; handle the error and statusCode
if let code = statusCode {
print("Personalisation failed with status code: \(code). Please contact support if unknown.")
} else {
print("Personalisation failed with no specific status code. Please contact support.")
}
}
}
}
}
Reset the terminal
In some rare cases when you need to disable/delete a terminal you can use our RESET api You will provide the information about the terminal that needs to be reset and PhonePos will take care everything
class MainViewController: UIViewController {
var phonePosApi: PhonePosApi!
// ...
private func resetTerminal() {
let provider = DataProviderFactory.chooseYourData(...) // Replace with actual parameters
phonePosApi.getConfigurationApi().reset { wasResetSuccess in
if wasResetSuccess {
// Reset was successful
print("Terminal reset successfully.")
} else {
// Reset was NOT successful; you may want to retry the operation
print("Reset was not successful. Please try again.")
// Handle potential retries or alerts to the user
}
}
}
}