1. Perform the refund

// Build the refund request
MyPOSRefund refund = MyPOSRefund.builder()
	// Mandatory parameters
	// Optional parameters
        // Set print receipt mode
// If you want to initiate a moto transaction:

// Or you want to initiate a giftcard transaction:

// Start the transaction
MyPOSAPI.openRefundActivity(MainActivity.this, refund, 2);

2. Handle the result

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

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // The same request code as when calling MyPOSAPI.openRefundActivity
    if (requestCode == 2) {
        // The transaction was processed, handle the response
        if (resultCode == RESULT_OK) {
            // Something went wrong in the Payment core app and the result couldn't be returned properly
            if (data == null) {
                Toast.makeText(this, "Transaction cancelled", Toast.LENGTH_SHORT).show();
            int transactionResult = data.getIntExtra("status", TransactionProcessingResult.TRANSACTION_FAILED);

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

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