Skip to main content
Version: Live

SuccessfulTransactionResult

The SuccessfulTransactionResult class represents a successful payment transaction.

Properties​

PropertyTypeDescription
stateStringThe state of the transaction (e.g., "PENDING")
amountStringThe transaction amount
brandStringThe payment method brand
lastFourStringLast four digits of the payment method
serviceFeeStringThe service fee amount
currencyStringThe transaction currency
metadataMap<String, Any>?Optional metadata associated with the transaction
receiptNumberStringThe unique transaction_id assigned to a transaction by Pay Theory
createdAtStringTimestamp of when the transaction was created
paymentMethodIdStringID of the payment method used
payorIdStringID of the payor who made the payment

Failed Transaction Result​

The FailedTransactionResult class represents a failed payment transaction.

Properties​

PropertyTypeDescription
stateStringThe state of the transaction (e.g., "FAILURE")
brandStringThe payment method brand
lastFourStringLast four digits of the payment method
receiptNumberStringThe unique transaction_id assigned to a transaction by Pay Theory
paymentMethodIdStringID of the payment method used
payorIdStringID of the payor who attempted the payment

Example Usage​

class PaymentActivity : PayTheoryMerchantActivity(), Payable {
override fun handleSuccess(result: SuccessfulTransactionResult) {
// Handle successful payment
println("Payment Successful!")
println("Receipt Number: ${result.receiptNumber}")
println("Amount: ${result.amount}")
println("Payment Method: ${result.brand} ending in ${result.lastFour}")

if (result.serviceFee.toInt() > 0) {
println("Service Fee: ${result.serviceFee}")
}
}

override fun handleFailure(result: FailedTransactionResult) {
// Handle failed payment
println("Payment Failed!")
println("Receipt Number: ${result.receiptNumber}")
println("Payment Method: ${result.brand} ending in ${result.lastFour}")

// Show failure message to user
showError("Payment could not be processed. Please try again.")
}
}