Baxi POS Card Payment Lib Documentation

Arinze George
3 min readOct 20, 2020

This document illustrates how to init and use the baxi pos card payment library 2.0

So firstly this library is written with Java and Kotlin combined however it is recommended for 3rd parties implementing this to use Kotlin. Lets start with adding the lib to your project files.

1. Include the lib to your project files.

You can add this lib to your project files using any method best to you but we recommend using a lib folder.

a. Create a ‘libs’ folder if you don’t already have it under src/main.

b. Copy your .aar file to src/main/libs

c. Open ‘build.gradle’ file(the one under ‘app’) and add dependency compile(name:’my_library’, ext:’aar’)

d. Open the top level ‘build.gradle’ file(the one under ‘project’) and add flatDir {dirs ‘libs’}

e. Sync your project with gradle.

2. Initializing the Lib

Firstly we initialize the lib in the onCreate method of the activity or application class. This downloads all the required parameters for initializing a card payment.

3. Downloading Parameters

All the parameters required to carry out a card transaction are downloaded once and at the initialization of the lib. This method downloads all the parameters and are saved and used through out the life span of the application.

You can observe the status of this download using the ‘configStatus’ variable. This is a livedata that emits enum values of the stage of the download. You can use an ‘if-statement’ to control the diff values, the value ‘FINISH’ indicates download is completed and you can proceed to other parts of your application. This download is asynchronous.

To start a card payment, call the ‘startPay’ method passing in an arg which is details of the payment and the activity instance.

To get response about the payment, on the activityResult method get the payment details and check the response code. a response code of “00” means payment is successful and you can proceed to give value.

Thanks, stay jiggy.

--

--