Start Transaction
tapToPaySdk.startTransaction(activity, transactionRequest)
Create a TransactionRequest
and invoke tapToPaySdk.startTransaction()
to start a payment or refund.
Transaction results will be received in the onTransactionResult
callback passed to tapToPaySdk.registerTransactionResultHandler().
@Throws(InvalidTransactionParamException::class)
fun startTransaction(
activity: ComponentActivity,
transactionRequest: TransactionRequest
)
Throws InvalidTransactionParamException Exception
It is strongly recommended to handle any exceptions thrown by tapToPaySdk.startTransaction()
otherwise your App will crash.
Throws InvalidTransactionParamException
when one of the following conditions is not met.
amountInCents
must be positive and non zeroamountInCents
must be less than 10,000,000 ($100,000.00)reference
must not be blank
Parameters
activity required | ComponentActivity The Android Activity |
transactionRequest required | TransactionRequest The request parameters for the transaction. |
TransactionRequest
Request parameters for the transaction. This determines if the transaction is a purchase or refund.
PosInfo
must be set via sdk.setPosInfo(posInfo)
or in this function otherwise an error will be thrown. See PosInfo.
@Parcelize
data class TransactionRequest(
val type: TransactionType,
val amountInCents: Int,
val reference: String,
var posInfo: PosInfo? = null,
) : Parcelable
Parameters
type required | TransactionType The type of transaction |
amountInCents required | Int The amount in cents. |
reference required | String The identifier for the transaction and MUST be unique. |
posInfo | PosInfo Optionally provide the PosInfo per transaction. PosInfo must be provided via this parameter or in sdk.setPosInfo() otherwise an error will be thrown. |