Ingenico provides the API Management to check the authorization to use the other APIs. We can use this API by calling subscribe method. Its syntax is given below
First you have to import the api management package
com.ingenico.sdk.apimanagement
Once the importing is done you have to instantiate the API Management
IApiManagement apiManagement = ApiManagement.getInstance(myContext);
After importig the package you have to use subscripe method with your intial Token in parameter, this method will call the CSC and ask for a usage token the usage Token will be used to check authorization
long subscribe(java.lang.String apiKey)
Note : This method make network requests and can be blocking, it must NOT be called from the main thread.
Code:
private void initApiManagement() {
new Thread() {
@Override
public void run() {
IApiManagement apiManagement = ApiManagement.getInstance(myContext);
try {
apiManagement.subscribe(API_KEY);
} catch (IngenicoException e) {
Log.e(TAG, "Error registering API key: " + e.getMessage(), e);
}
onApiManagementReady();
}
}.start();
}