Integrate our products into your software. Let's make payment happen together!
Look at all the possibilitiesWith this guide we will use the opiTerminalDiscoveryService to retrieve our terminal request object.
This object is required by all other api-methods as it will describe the destination of our call.
For this guide we will the automaticTerminalDiscovery which scans our network for all possible attended terminals (protocol unspecific).
With this method you have the option to only search for local terminals. These are terminals located on the same device as the POS application with localhost (127.0.0.1) as IP address.
void automaticTerminalDiscovery(TerminalDiscoveryDelegate delegate, boolean onlySearchForLocalTerminal)
This is the callback mechanism which we use to pass the responses to the integrator.
TerminalDiscoveryDelegate discoveryDelegate = new TerminalDiscoveryDelegate() { @Override public void onComplete(Listterminals) { //contains a list of terminals which can be used to execute ur api request } @Override public void onNextTerminal(ExternalTerminal terminal) { //This method can be used as an async method as it will pass each terminal as it is found and will not wait until the process is done } @Override public void onError(Error error) { //contains code which handles a failed payment } };
Now that all our request object are ready, we can create an instance of the service we want to use.
TerminalDiscoveryApi discoveryService = new eu.ccvlab.mapi.api.TerminalDiscoveryService();
discoveryService.automaticTerminalDiscovery(discoveryDelegate, false);
discoveryService.automaticTerminalDiscovery(discoveryDelegate, true);
Now that you have your request object already constructed for you, you can use it to do your very first transaction.