Skip to main content

Package name

// Production
com.lab4pay.pos

// Sandbox
com.lab4pay.pos.staging

Charge

Generating or applying a payment using any card or digital method.

Revert

Reversing a transaction, returning the money to the original account.

Refund

Refund a related transaction, returning the money to the original account.

Independent refund

Refund an unrelated transaction, returning the money to tapped card.

High-level flow

  1. Client’s app constructs an explicit Intent targeting Payment app and specifies the desired action.
  2. Client’s app launches the Intent with registerForActivityResult(StartActivityForResult).
  3. The user pays (or cancels).
  4. Payment app returns a result Intent with details via setResult(...) and finish().
  5. Client’s app finalizes the order.

Charge Intent Contract

Request action

com.lab4pay.pos.CHARGE

Request parameters

NameTypeExampleNotes
payConnectIntegratorIdString9e6d06fe0322Your Integrator ID. For reference see the Integrator Registry section
payConnectIdString350344d0718bPay-Connect ID returned from Pairing section
amountInteger2350The amount of the payment, in cents
clientTransactionIdStringref-49152Unique per payment attempt

Response

  • Result codes:
    • Activity.RESULT_OK -> The payment app completed normally and returned a valid result Intent. Additional details are provided in the Intent extras.
    • Activity.RESULT_CANCELED -> Payment flow ended unexpectedly (user exited early or app failed before returning a result). No Intent extras are available.
  • Data: An Intent with Response extras

Response extras

NameTypeRequiredNotes
transactionIdStringYes - When SUCCESSOur unique transaction reference
clientTransactionIdStringYesEchoed from original request
paymentMethodStringYes - When SUCCESSe.g., CARD, MBILLS, VALU
paymentOptionStringNoDepends on payment method. e.g., VISA, MASTERCARD, BTC, USDT
amountIntegerYes - When SUCCESSThe amount of the payment, in cents
tipAmountIntegerYes - When providedThe tip amount of the payment, in cents
currencyStringYesCurrency format ISO 4217
statusStringYesSUCCESS | CANCELED | FAILED

Revert Intent Contract

Request action

com.lab4pay.pos.REVERT

Request parameters

NameTypeExampleNotes
payConnectIntegratorIdString9e6d06fe0322Your Integrator ID. For reference see the Integrator Registry section
payConnectIdString350344d0718bPay-Connect ID returned from Pairing section
transactionIdString41dTf452a3b2The CHARGE transaction ID returned in transactionId
Only the most recent SUCCESS transaction performed on the terminal can be reverted.
Reverts are only available for certain payment methods.

Response

  • Result codes:
    • Activity.RESULT_OK -> The payment app completed normally and returned a valid result Intent. Additional details are provided in the Intent extras.
    • Activity.RESULT_CANCELED -> Payment flow ended unexpectedly (user exited early or app failed before returning a result). No Intent extras are available.
  • Data: An Intent with Response extras

Response extras

NameTypeRequiredNotes
transactionIdStringYesEchoed from original request
statusStringYesSUCCESS | FAILED

Refund Intent Contract

Request action

com.lab4pay.pos.REFUND

Request parameters

NameTypeExampleNotes
payConnectIntegratorIdString9e6d06fe0322Your Integrator ID. For reference see the Integrator Registry section
payConnectIdString350344d0718bPay-Connect ID returned from Pairing section
transactionIdString41dTf452a3b2The CHARGE transaction ID returned in transactionId
clientTransactionIdStringref-49152Unique per refund attempt
amountInteger2350The amount of the refund, in cents
Only SUCCESS charge transactions can be refunded.
Refund amount must not exceed the remaining refundable amount.
Refunds are only available for supported payment methods.

Response

  • Result codes:
    • Activity.RESULT_OK -> The payment app completed normally and returned a valid result Intent. Additional details are provided in the Intent extras.
    • Activity.RESULT_CANCELED -> Payment flow ended unexpectedly (user exited early or app failed before returning a result). No Intent extras are available.
  • Data: An Intent with Response extras

Response extras

NameTypeRequiredNotes
transactionIdStringYes - When SUCCESSOur unique transaction reference
clientTransactionIdStringYesEchoed from original request
paymentMethodStringYes - When SUCCESSe.g., CARD, MBILLS, VALU
paymentOptionStringNoDepends on payment method. e.g., VISA, MASTERCARD, BTC, USDT
amountIntegerYes - When SUCCESSThe amount of the payment, in cents
currencyStringYesCurrency format ISO 4217
statusStringYesSUCCESS | CANCELED | FAILED

Independent Refund Intent Contract

Request action

com.lab4pay.pos.INDEPENDENT_REFUND

Request parameters

NameTypeExampleNotes
payConnectIntegratorIdString9e6d06fe0322Your Integrator ID. For reference see the Integrator Registry section
payConnectIdString350344d0718bPay-Connect ID returned from Pairing section
clientTransactionIdStringref-49152Unique per refund attempt
amountInteger2350The amount of the refund, in cents
Independent refunds are not linked to a previous charge transaction.
Independent refunds require CARD payment method support on the terminal.

Response

  • Result codes:
    • Activity.RESULT_OK -> The payment app completed normally and returned a valid result Intent. Additional details are provided in the Intent extras.
    • Activity.RESULT_CANCELED -> Payment flow ended unexpectedly (user exited early or app failed before returning a result). No Intent extras are available.
  • Data: An Intent with Response extras

Response extras

NameTypeRequiredNotes
transactionIdStringYes - When SUCCESSOur unique transaction reference
clientTransactionIdStringYesEchoed from original request
paymentMethodStringYes - When SUCCESSOnly CARD payment method
paymentOptionStringNoDepends on payment method. e.g., VISA, MASTERCARD
amountIntegerYes - When SUCCESSThe amount of the payment, in cents
currencyStringYesCurrency format ISO 4217
statusStringYesSUCCESS | CANCELED | FAILED

Pay-Connect OTP Intent Contract

Request action

com.lab4pay.pos.PAY_CONNECT_OTP

Request parameters

NameTypeExampleNotes
payConnectIntegratorIdString9e6d06fe0322Your Integrator ID. For reference see the Integrator Registry section
The terminal must not be already paired with Pay-Connect.

Response

  • Result codes:
    • Activity.RESULT_OK -> The payment app completed normally and returned a valid result Intent. Additional details are provided in the Intent extras.
    • Activity.RESULT_CANCELED -> Payment flow ended unexpectedly (user exited early or app failed before returning a result). No Intent extras are available.
  • Data: An Intent with Response extras

Response extras

NameTypeRequiredNotes
otpStringYes - When SUCCESSOTP used for Pay-Connect terminal pairing

Example: Android Intent

class PaymentActivity : AppCompatActivity() {

    private const val TAG = "PaymentActivity"

    private val chargeLauncher =
        registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
            handleChargeResult(result)
        }

    private fun launchCharge() {
        val intent = Intent("com.lab4pay.pos.CHARGE").apply {
            setPackage("com.lab4pay.pos")
            putExtra("amount", 2350)
            putExtra("clientTransactionId", "ref-49152")
        }
        chargeLauncher.launch(intent)
    }

    private fun handleChargeResult(result: ActivityResult) {
        when (result.resultCode) {
            Activity.RESULT_OK -> {
                val data = result.data ?: return
                val status = data.getStringExtra("status")
                val clientTransactionId = data.getStringExtra("clientTransactionId")

                when (status) {
                    "SUCCESS" -> {
                        val transactionId = data.getStringExtra("transactionId")
                        val paymentMethod = data.getStringExtra("paymentMethod")
                        val paymentOption = data.getStringExtra("paymentOption")
                        val amount = data.getIntExtra("amount", 0)
                        val tipAmount = data.getIntExtra("tipAmount", 0)
                        val currency = data.getStringExtra("currency")

                        Log.i(TAG, "Payment successful: id=$transactionId, amount=$amount $currency, method=$paymentMethod, ref=$clientTransactionId, ts=$timestamp")
                        // finalize order and update backend
                    }

                    "FAILED" -> {
                        Log.e(TAG, "Payment failed for ref=$clientTransactionId")
                        // show failure message or retry
                    }

                    "CANCELED" -> {
                        Log.w(TAG, "Payment canceled by user: ref=$clientTransactionId")
                        // handle user cancellation
                    }

                    else -> Log.e(TAG, "Unknown status: $status")
                }
            }

            Activity.RESULT_CANCELED -> {
                Log.w(TAG, "Payment flow aborted. No result Intent returned.")
                // allow retry or mark as incomplete
            }

            else -> Log.w(TAG, "Unexpected resultCode: ${result.resultCode}")
        }
    }
}