The Payble QPOS SDK allows for seamless integration of QPOS device functionalities into your Android application. Below are the steps to integrate and use the SDK effectively:
In your Application
class, initialize the SDK using the initPayble
method:
class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()
QposInitializer.getInstance().initPayble("merchantKey", "merchantId", applicationContext)
}
}
Before interacting with the QPOS device, you need to initialize it. This can be done in your MainActivity
or any other activity:
QposInitializer.getInstance().initializeQpos(SampleApplication(), this, this)
You can fetch the agent details anytime before or after initializing the QPOS device:
QposInitializer.getInstance().getAgentDetails("agentId", this, this)
To search for available QPOS devices:
QposInitializer.getInstance().searchForDevices(this)
Once a device is found, you can connect to it using its Bluetooth address:
QposInitializer.getInstance().connectBluetoothDevice("30:3D:51:46:CF:C6")
To perform a transaction, you first need to set the transaction parameters and then start the trade:
QposInitializer.getInstance().setTransactionParam("10000", "566")
QposInitializer.getInstance().startTrade()
The SDK provides several callback methods to handle different EMV events, such as card insertion, card reading, transaction processing, and more. Here’s an example implementation in MainActivity
:
class MainActivity : AppCompatActivity(), EMVEvents {
// Override various EMV event methods
override fun onInsertCard() { /* handle card insertion */ }
override fun onRemoveCard(isContactlessTransLimit: Boolean, message: String) { /* handle card removal */ }
override fun onCardRead(pan: String, cardType: PaybleConstants.CardType) { /* handle card read */ }
override fun onCardDetected(contact: Boolean) { /* handle card detected */ }
override fun onEmvProcessing(message: String) { /* handle EMV processing */ }
override fun onPinInput(): String? { return "1234" } // Example of returning a fixed PIN
override fun onEmvProcessed(data: Any) { /* handle processed EMV data */ }
// Other event methods...
}
This documentation provides a basic overview of how to integrate the Payble QPOS SDK into your Android application. By following these steps, you can ensure a smooth integration process, enabling your app to handle device connections, transactions, and EMV events effectively.