Android SDK - Token Management Module

The token management module of the SDK encompasses all functionality that relates to identifying and decoding Paydiant payment tokens. Payment tokens are used to establish a transactional connection between point of sale terminal, the Paydiant server, and the mobile device. This topic describes the methods exposed in the token management module.

The services exposed in the order history module are located in the following package classes:

Item Description
UI Service
Core Service Paydiant uses the ZXing jar to implement the token decoding functionality in the UI package. In order for developers to use the core package to implement this functionality, they would be forced to re-implement the UI service layer manually, a complex and redundant task that would essentially produce a facsimile of the UI package. For this reason, extension using the core package is not supported for the token management module.

Set UI Package Token Management Listeners

In order to invoke the callback methods returned by the Paydiant service in response to the methods called from the Token Management module of the SDK, set an implementation of the listener interface in the UI Service class:

Name Description
Set Listener void setTokenManagementListener(ICaptureTokenListenerlistener);
or an overridden instance of Listener
Remove Token Listener void removeTokenManagementListener();
Resets the capture token listener to null so that it does not interfere with other uses of the camera.
Set Camera Listener void setCameraEventListener(ICameraEventListener listener);
This optional listener implementation sets the listener interface to support custom camera parameter configurations that occur during the camera activities of token scanning.

Obtain Checkout Token

This method enables the app to request a token code from the Paydiant server in order to generate the graphic image on the phone, where it can be scanned by a POS terminal or captured internally by the mobile payments app in order to initiate a transaction.

Item Description
Method void obtainCheckoutToken(String checkoutTokenType, int height, int width);

height - An integer value indicating the vertical dimension of the token image in centimeters.
width - An integer value indicating the horizontal dimension of the token image in centimeters.
checkoutTokenType - Specifies the type of transaction for which the token is requested.

Valid enum values are:
CASH_ACCESS - The token initiates a transaction for an ATM withdrawal.
FUEL - The token initiates a transaction with a fuel pump.
OFFER - The token activates an offer in the wallet.
PURCHASE - The token initiates a payment transaction.
REFUND - The token initiates a refund transaction.
Success void onObtainCheckoutSuccess (Bitmap tokenImage, String qrCode);

tokenImage - The image file representing the generated QR Code.
qrCode - The raw value of the generated checkout token.
Failure void onObtainCheckoutError (PaydiantException exception);

Release Checkout Token

When the checkout token is generated by the phone instead of the POS, this method provides a means to release the token in the event it is no longer needed.

Item Description
Method void releaseCheckoutToken(String checkoutTokenValue);

checkoutTokenValue - Identifies the checkout token value to be released.
Success void onReleaseCheckoutSuccess();
Failure void onReleaseCheckoutError (PaydiantException exception);

Activate Camera

This method lets the application control an instance of the Android device camera in order to capture the presented payment token.

Item Description
UI Method void startCameraSession(ViewFinderView ViewFinderView, SurfaceView surfaceView);

viewFinderView - An instance of the ViewFinderView class that specifies the configurable parameters of the camera session, if applicable. This parameter is optional.
surfaceView - An instance of the Android SurfaceView class that establishes a dedicated drawing surface within the camera view.

Returns no payload.

Change View Finder Dimension

This method sets the view finder view frame dimensions. Default values are used if the values entered are absent or incorrect.

Item Description
UI Method boolean changeViewFinderFrameDimension(int startX, int startY, int frameWidth, int frameHeight)

startX - The X coordinate of the starting center position of the view finder.
startY - The Y coordinate of the starting center position of the view finder.
frameWidth - The horizontal length of the view finder frame.
frameHeight - The vertical length of the view finder frame.

Returns PaydiantClientException

Configure Camera

This method enables the developer to configure the camera to operate in a mode that is conducive to optimizing image capture.

Item Description
UI Method void setCameraConfigParams(CameraConfigParameters cameraConfigParams);

cameraConfigParams - An instance of the CameraConfigParameters object that sets a variety of optional settings, such as orientation, filter effects, preview window, and other settings. Returns no payload.

Release Camera

This method terminates the session with the camera and releases it for use by other phone applications.

Item Description
UI Method void stopCameraSession();

Other Resources