Sending Receipts via Email

You can send the customer receipt via email instead of printing it. Examples of the calls used to send the customer receipt via email are shown below:
Kotlin
// transactionIdentifier: The transaction identifier for the receipt to be sent. val intent = mposUi.createSendEmailReceiptIntent(transactionIdentifier)
Java
// transactionIdentifier: The transaction identifier for the receipt to be sent. Intent intent = mposUi.createSendEmailReceiptIntent(transactionIdentifier);
To check if the receipt sending process was successful, use the callback function
onActivityResult
. This method is triggered after the Summary screen is closed and will behave the same way as the transaction results, but with a different result code.
Kotlin
// override this function for customised behaviours if needed override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) "onActivityResult: $resultCode".logDebug(TAG) if (requestCode == MposUi.REQUEST_CODE_PAYMENT) { val parentLayout: View = activity!!.findViewById(android.R.id.content) when (resultCode) { MposUi.RESULT_CODE_PRINT_SUCCESS -> Snackbar.make(parentLayout, "Printing success", Snackbar.LENGTH_SHORT).show() MposUi.RESULT_CODE_PRINT_FAILED -> Snackbar.make(parentLayout, "Printing failed", Snackbar.LENGTH_SHORT).show() MposUi.RESULT_CODE_EMAIL_FAILED -> Snackbar.make(parentLayout, "Fail while sending email via email", Snackbar.LENGTH_SHORT).show() MposUi.RESULT_CODE_EMAIL_SUCCESS -> Snackbar.make(parentLayout, "Receipt sent via email", Snackbar.LENGTH_SHORT).show() ... } } }
Related Links