PAaS 2 Library
Last updated: 2026-05-14
PAaS 2 Library
PAaS 2 is distributed as paaslib_2.0.11.aar. The primary class is CarbonTerminal, which implements the PaymentTerminal interface and exposes payment, printer, terminal status, and device-control functions.
kotlinimport se.westpay.paaslib.service.CarbonTerminal val terminal = CarbonTerminal()
Main Packages
| Package | Purpose |
|---|---|
se.westpay.paaslib.service | CarbonTerminal, PaymentTerminal, service parameters, and terminal operations. |
se.westpay.paaslib.initialisation | TerminalSettings, initialisation response models, and status callbacks. |
se.westpay.paaslib.transaction | Transaction requests, responses, payment data, errors, and transaction enums. |
se.westpay.paaslib.printer | PrintJob, PrinterStatus, text and bitmap printing. |
se.westpay.paaslib.notification | Notification data and notification callbacks. |
se.westpay.paaslib.androidplatform | Navigation bar and system UI controls. |
se.westpay.paaslib.utility | Utility values such as suspend time options. |
Core Lifecycle Methods
| Method | Purpose |
|---|---|
register(context, response) | Creates resources needed to communicate with the Payment Application service. |
initialise(settings, response, notification) | Downloads terminal configuration, logs on to the host, and prepares the terminal for transactions. |
createIntentForTransaction(transaction) | Converts a TransactionRequest into an Android Intent used to launch payment. |
createTransactionResponseFromIntent(intent) | Converts the returned result Intent into a TransactionResponse. |
startPrintJob(context) | Starts a printer job for text or bitmap receipt printing. |
notifyExit(context) | Notifies the Payment Application before the PAaS app exits. |
Register
kotlinfun register( context: Context?, response: RegisterResponseHandler? = null ): Boolean
Example:
kotlinval registered = terminal.register( requireContext(), object : RegisterResponseHandler { override fun onRegisterCompleted(success: Boolean) { Log.i("PAaS", "Connected to payment service: $success") } } )
Initialise
kotlinfun initialise( settings: TerminalSettings, response: InitialisationResponseHandler, notification: NotificationHandler? ): Boolean
initialise returns whether the request was accepted, not whether initialisation succeeded. The actual result is returned through the response callback.
kotlinval settings = TerminalSettings( terminalId = "80000001", authHosts = arrayOf("185.27.171.42:55144"), configHosts = arrayOf("185.27.171.42:55133"), language = "sv-SE", forceLogin = false ) terminal.initialise( settings = settings, response = object : InitialisationResponseHandler { override fun onInitialisationCompleted(result: InitialisationResponse) { Log.i("PAaS", "Initialised: ${result.getTerminalStatus()}") } }, notification = object : NotificationHandler { override fun onNotification(event: NotificationEvent, info: String) { Log.i("PAaS", "Event: $event $info") } } )
Transactions
kotlinfun createIntentForTransaction(transaction: TransactionRequest): Intent? fun createTransactionResponseFromIntent(intent: Intent?): TransactionResponse
kotlinval purchase = PurchaseRequest( currencyId = Constants.CURRENCY_ID_NUMBER_DEFAULT, totalAmount = 10000, saleId = "sale-1001", loyaltyApplications = emptyArray(), paymentMethod = "", cashBackAmount = 0, tipAmount = 0, maximumTipAmount = 0, maximumTipPercent = 100, allowSkipTip = SkipTipOptions.NO ) val intent = terminal.createIntentForTransaction(purchase) transactionLauncher.launch(intent)
Printer
kotlinfun startPrintJob(context: Context): PrintJob
kotlinval printJob = terminal.startPrintJob(requireContext()) printJob.printTextLine("Merchant receipt", null, null, monospace = false, bold = true) val status = printJob.finish()
Terminal and Device Operations
PAaS 2 also exposes operations for terminal state and Android terminal behaviour.
| Method | Purpose |
|---|---|
getTerminalStatus | Retrieves terminal status after initialisation. |
getLastTransactionResult | Retrieves the last transaction result. |
getPrinterStatus | Reads printer status. |
enableNavigationBar / disableNavigationBar | Controls Android navigation bar visibility/buttons. |
setSleepTime / getSleepTime | Controls device sleep time. |
setSuspendTime / getSuspendTime | Controls suspend behaviour. |
systemWakeUp | Wakes the terminal system. |
validateMerchantPassword | Validates merchant password when required. |
shutdown | Requests terminal shutdown. |
Exit
kotlinfun notifyExit(context: Context): Boolean
Call this before leaving the PAaS application.
kotlinterminal.notifyExit(requireContext()) requireActivity().finishAffinity()