After a transaction where a signature was collected, call uploadSignature() to attach the signature image to the transaction record.
Function signature
fun uploadSignature(
pngEncodedBase64: String,
traceId: String,
)| Parameter | Type | Description |
|---|---|---|
pngEncodedBase64 | String | The buyer's signature as a base64-encoded PNG. |
traceId | String | The trace ID from the TransactionResult returned in onSuccess. |
Upload after a transaction
Call uploadSignature() inside the onSuccess callback of startTransaction() when promptForSignature is not Never.
fun uploadSignature(
pngEncodedBase64: String,
traceId: String,
)
mpos.startTransaction(
amount = 1000L,
transactionType = TransactionType.SALE,
transactionCallback = object : MPOSTransactionCallback {
override fun onSuccess(result: TransactionResult?) {
result?.traceId?.let { traceId ->
mpos.uploadSignature(
pngEncodedBase64 = capturedSignaturePng,
traceId = traceId
)
}
}
override fun onError(errorMessage: String) { }
override fun onProcessing(currentStepMessage: String) { }
},
promptForSignature = PromptForSignature.Always
)