SDK Overview
The TNSPay BYOA (Bring Your Own App) SDK empowers developers to build custom applications directly on card terminal devices, enabling secure, compliant, and feature-rich payment experiences. Designed for flexibility and speed, the SDK provides all the tools needed to integrate with payment gateways, manage transaction flows, and control terminal behaviour.
SDK Components Explained
PaymentSDK Class
This is the main class that third-party developers will use.
It handles:
- Binding to the payment service
- Sending Payment Requests
- Releasing the service when done
RequestMsg
A data class that encapsulates all the information needed for a transaction:
- msgType Type of transaction
- amount Transaction amount
- currency Currency code
- invoiceNbr
origTransNo
Additional fields for tracking
PaymentResponseService
A singleton object that provides three callback hooks:
- responseCallback Final result of the transaction in Json format
- messageCallback Intermediate messages (e.g. “Insert Card”)
- stateCallback State changes (e.g. “Processing”, “Completed”)
Security Model
The payment app uses a whitelist mechanism to ensure only trusted apps can bind to it. When a client app tries to connect:
- The payment app checks the calling package name.
- If it’s not in the whitelist (
com.tnsi.clientapp,com.tnsi.thirdpartyapp), it throws aSecurityException.
This ensures that only authorized apps can initiate payments.
Why Use the SDK Instead of AIDL Directly?
- Simplifies development: No need to manage
ServiceConnection,IBinder, or AIDL interfaces manually. - Error handling: Built-in error callbacks.
- Cleaner code: Developers can focus on business logic, not IPC.
Based on the sample code and documentation provided, here's a comprehensive integration guide for third-party developers to use the com.tnsi.sdk.PaymentSdk in their Android applications:
On this page
- SDK Overview