Initiate Void Transaction API

The Initiate Void Transaction API is used void an existing transaction that was initiated on an Android POS device.

Method: POST

Create a PaymentInitialization class object and call initiateVoidTransaction() method by passing the parameters mentioned in the request parameter table.

Request parameters

ParameterDescriptionExample
Handler object

mandatory
handler Create a handler inner class. This class will return the response message.handler
referenceNumber

mandatory
string Pass this parameter to receive the receipt reference number after transaction completed.OD0576
appName

mandatory
string The name of the application.null
appVersion

mandatory
string The version of the application.null

Sample request

try {
PaymentInitialization initialization = new PaymentInitialization(
getApplicationContext());
initialization.initiateVoidTransaction(voidHandler,txnResponse.getReferenceNumber()
,null,null);
} catch (RuntimeException e) {
e.printStackTrace();
}

Response parameters

ParameterDescriptionExample
Reference numberThe reference number of the transaction.150410087276
AmountThe transaction amount.200.00
Amount authorizedThe authorized transaction amount.10.00
RRNRRN is a unique 12-digit number to identify a particular transaction.453654
Transaction StatusThe status of the void transaction.



Fail - If transaction is not voided, then it will return fail.

Success - If the transaction is voided, then it will return the TransactionResponse object.
Success
isSignature requiredWhether the signature is required. Default possible values are - Yes/NoYes

Sample response

Use this code to fetch the response of this API.

private final Handler voidHandler = new Handler()
{
	public void handleMessage(android.os.Message msg)
	{
		if (msg.what == SUCCESS)
		{
			String data = null;
			try
			{
				TransactionResponse hs = (TransactionResponse) msg.obj;
				data = new
				ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(hs);
			}
			catch (JsonGenerationException e1)
			{
				e1.printStackTrace();
			}
			catch (JsonMappingException e1)
			{
				e1.printStackTrace();
			}
			catch (IOException e1)
			{
				e1.printStackTrace();
			}
			t
			ransactionresponse.setText(getString(R.string.void_Data) + "\n" + data);
			Toast.makeText(PaymentDetails.this, getString(R.string.void_success),
				Toast.LENGTH_LONG).show();
		}
		i
		f(msg.what == FAIL)
		{
			Toast.makeText(PaymentDetails.this, (String) msg.obj,
				Toast.LENGTH_LONG).show();
		}
		else if (msg.what == ERROR_MESSAGE)
		{
			Toast.makeText(PaymentDetails.this, (String) msg.obj,
				Toast.LENGTH_LONG).show();
		}
	};
};