Skip to main content
Version: Lab (preview)

BarcodeResult

The BarcodeResult class represents the response from a successful cash payment setup. It contains all the necessary information for processing a cash payment, including the barcode and payment location details.

Properties​

PropertyTypeDescription
barcodeIdStringPay Theory's unique identifier for the barcode
barcodeUrlStringURL to view the barcode image
barcodeStringThe actual barcode number
barcodeFeeStringFee associated with the barcode payment
merchantStringThe merchant identifier
mapUrlStringURL to find retail locations for making the payment

Example Usage​

class CashPaymentActivity : PayTheoryMerchantActivity(), Payable {
private lateinit var barcodeView: PayTheoryBarcode

override fun handleBarcodeSuccess(result: BarcodeResult) {
// Display the barcode
barcodeView.displayBarcode(result)

// Show payment details
println("Barcode ID: ${result.barcodeId}")
println("Payment Fee: ${result.barcodeFee}")

// Open payment locations map
openUrl(result.mapUrl)
}

override fun handleError(error: PTError) {
// Handle barcode generation errors
showError("Failed to generate barcode: ${error.error}")
}
}