Void Request

1. Perform a void transaction

// Build the void transaction
private static final int VOID_REQUEST_CODE = 4;
   private void startVoid() {
       // Build the void request
       MyPOSVoid voidEx = MyPOSVoid.builder()
   //.voidLastTransactionFlag(true) // this may void last transaction initialized by this terminal
      // Start the void transaction
   MyPOSAPI.openVoidActivity(MainActivity.this, voidEx, VOID_REQUEST_CODE, true);


2. Handle the result

The same as with the payment, in your calling Activity, override the onActivityResult method to handle the result of the void request:

ovoid onActivityResult(int requestCode, int resultCode, Intent data) {
o    if (requestCode == VOID_REQUEST_CODE) {
o// The transaction was processed, handle the response
oif (resultCode == RESULT_OK) {
o// Something went wrong in the Payment core app and the result couldn't be returned properly
oif (data == null) {
oToast.makeText(this, "Transaction cancelled", Toast.LENGTH_SHORT).show();
oint transactionResult = data.getIntExtra("status", TransactionProcessingResult.TRANSACTION_FAILED);

oToast.makeText(this, "Void transaction has completed. Result: " + transactionResult, Toast.LENGTH_SHORT).show();

o// TODO: handle each transaction response accordingly
oif (transactionResult == TransactionProcessingResult.TRANSACTION_SUCCESS) {
o// Transaction is successful
o} else {
o// The user cancelled the transaction
oToast.makeText(this, "Transaction cancelled", Toast.LENGTH_SHORT).show();