Finalize Request
The Finalize Request method is used to finalize a previous web request tax calculation process. Only valid web requests for the current and prior calendar months can be finalized.
For development and testing with HTTPS POST, please use the following URL: https://testapi.taxrating.net/Services/V01/Energy/SureTax.asmx?op=FinalizePostRequest
Request layout
All fields are required unless otherwise noted. All field names are case-sensitive.
FIELD NAME | POST FIELD | DESCRIPTION |
---|---|---|
Client Number | ClientNumber | Client ID Number – provided by CCH SureTax. |
Client Tracking Field | ClientTracking | Optional. Field for client transaction tracking. |
Transaction ID | MasterTransId | Transaction ID of web request to be finalized. |
Validation Key | ValidationKey | Validation Key provided by CCH SureTax. Required for client access to API function. |
HTTPS POST - JSON finalize request format with sample data
{
"ClientNumber":"000000000",
"ClientTracking":"test",
"MasterTransId":"999",
"ValidationKey":"13290031-F004-4F00-BMN3-E979D6749B88"
}
HTTPS POST - XML finalize request format with sample data
<?xml version="1.0" encoding="utf-8"?>
<FinalizeRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ClientNumber>000000000</ClientNumber>
<ClientTracking>test</ClientTracking>
<MasterTransId>999</MasterTransId>
<ValidationKey>13290031-F004-4F00-BMN3-E979D6749B88</ValidationKey>
</FinalizeRequest>
SOAP 1.1 finalize request format sample
POST /V07/SureTax.asmx HTTP/1.1
Host: testapi.taxrating.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/FinalizeSoapRequest"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FinalizeSoapRequest xmlns="http://tempuri.org/">
<requestFinalize>
<ClientNumber>string</ClientNumber>
<ClientTracking>string</ClientTracking>
<MasterTransId>int</MasterTransId>
<ValidationKey>string</ValidationKey>
</requestFinalize>
</FinalizeSoapRequest>
</soap:Body>
</soap:Envelope>
SOAP 1.2 finalize request format sample
POST /V07/SureTax.asmx HTTP/1.1
Host: testapi.taxrating.net
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FinalizeSoapRequest xmlns="http://tempuri.org/">
<requestFinalize>
<ClientNumber>string</ClientNumber>
<ClientTracking>string</ClientTracking>
< MasterTransId>int</ MasterTransId>
<ValidationKey>string</ValidationKey>
</requestFinalize>
</FinalizeSoapRequest>
</soap12:Body>
</soap12:Envelope>
Response Message
FIELD NAME | DESCRIPTION |
---|---|
Successful | Response will be either ‘Y' or ‘N' : Y = Success / Success with errors N = Failure |
ResponseCode | ResponseCode: 9999 – Finalize Request was successful. 1101-1600 – Range of values for a failed request (no processing occurred). Values include: 1150 - Failure - Validation Key Required. 1151 - Failure - Invalid Validation Key. 1510 - Failure - Transaction is more than 60 days old. 9410 - Failure - Transaction is already finalized. |
HeaderMessage | Response message: For ResponseCode 9999 – “Success” For ResponseCode 9001 – “Success with Item errors”. See the ItemMessages field above for a list of items / errors. For ResponseCode 1100-1600 – Unsuccessful / declined web request. See above or (Appendix I) for a list. |
ClientTracking | Field for client transaction tracking. |
MasterTransId | Transaction ID (integer) – provided by CCH SureTax |
Response Examples
JSON finalize - response format with sample data
{
"Successful":"Y",
"ResponseCode":"9999",
"HeaderMessage":"Success",
"ClientTracking":"test",
"MasterTransId":0
}
XML finalize - response format with sample data
<?xml version="1.0"?>
<FinalizeResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Successful>Y</Successful>
<ResponseCode>9999</ResponseCode>
<HeaderMessage>Success</HeaderMessage>
<ClientTracking>test</ClientTracking>
<MasterTransId>0</MasterTransId>
</FinalizeResponse>
SOAP 1.1 finalize - response format with sample
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FinalizeSoapRequestResponse xmlns="http://tempuri.org/">
<FinalizeSoapRequestResult>
<Successful>string</Successful>
<ResponseCode>string</ResponseCode>
<HeaderMessage>string</HeaderMessage>
<ClientTracking>string</ClientTracking>
<MasterTransId>int</MasterTransId>
</FinalizeSoapRequestResult>
</FinalizeSoapRequestResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2 Finalize - response format with sample
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soapenvelope">
<soap12:Body>
<FinalizeSoapRequestResponse xmlns="http://tempuri.org/">
<FinalizeSoapRequestResult>
<Successful>string</Successful>
<ResponseCode>string</ResponseCode>
<HeaderMessage>string</HeaderMessage>
<ClientTracking>string</ClientTracking>
<MasterTransId>int</MasterTransId>
</FinalizeSoapRequestResult>
</FinalizeSoapRequestResponse>
</soap12:Body>
</soap12:Envelope>
Implementation Examples
PHP
Finalize Request using HTTPS POST and cURL
$FinalizeRequest["ClientNumber"] = "000000000";
$ FinalizeRequest ["ClientTracking"] = "test";
$ FinalizeRequest ["MasterTransId"] = "999";
$ FinalizeRequest ["ValidationKey"] = "13290031-F004-4F00-BMN3-E979D6749B88";
// $post_type determines what encoding type – either XML or JSON
if( $post_type == 'xml' ) {
//XML
$xmlclass = 'FinalizeRequest';
$url1 = "http://www.w3.org/2001/XMLSchema-instance";
$url2 = "http://www.w3.org/2001/XMLSchema";
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= "<" . $xmlclass . ' xmlns:xsi="' .$url1 .'" ';
$xml .= ' xmlns:xsd="' .$url2 .'">';
foreach( $postfields as $x => $y) {
$xml .= "<$x>".htmlentities( strval($y) ) . "</$x>";
}
$xml .= "</" . $xmlclass . ">";
$curl_data = $xml;
} else {
// JSON
$json = json_encode($postfields);
$curl_data = $json;
}
// Initiate cURL request
$ch = curl_init();
// SureTax Finalize request URL
$suretax_url = ‘https://testapi.taxrating.net/Services/V07/SureTax.asmx?op=FinalizePostRequest’;
// Set Headers
curl_setopt($ch, CURLOPT_POSTFIELDS, "requestFinalize=$curl_data" ); // Assign POST Data
curl_setopt($ch, CURLOPT_POST, 1); // Select POST as transfer type
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_URL,$ suretax_url); // The Web service URL
curl_setopt($ch, CURLOPT_TIMEOUT, 9); // Set timeout
$response = curl_getinfo($ch); curl_close($ch);
Note
No HTTP header should be provided (no need to supply the cURL CURLOPT_HTTPHEADER option.
Response
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">JSON or XML string</string>
.NET
Finalize Request
POST /V07/SureTax.asmx/FinalizePostRequest HTTP/1.1
Host: testapi.taxrating.net
Content-Type: application/x-www-form-urlencoded
Content-Length: length requestFinalize=string
Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">string</string>