HTTPResponse Class

This is the class which actually represents the response as you can see in the Gateway section all four transaction methods i.e. purchase, refund, rebill and voidTransaction returns HTTPResponse.

Below are the methods found in this class with short description.


Once you have executed the transaction by any of four methods i.e. purchase, refund, void or rebill, First thing you would like to check was that transaction successful or not? This is where isSuccessfull method comes handy.

isSuccessful method returns boolean so you could easily check by sample code. Consider you saved response in response variable.

    //handle successful transaction
    //handle failed transaction


Second thing you would like to do is get the actual response and see the data. This is where you will be using getJSONResponse method.

This method returns the JSONObject. Below is the sample code.

   JSONObject json = response.getJSONResponse();
Note: To understand the API response in great detail see the API Responses section


Some times for debugging purpose developers want to track the actual time an http request took to completely the execution. For this purpose you will be using getResponseTime.

This method returns time in milliseconds. Below is the sample code.