Skip to main content

Exploring SDK of TaxBandits API

· 5 min read
TaxBandits Tech

TaxBandits offers open Software Development Kit (SDK) libraries that are available in several programming languages , such as Java, Node JS, .Net, PHP, and Python.

Prerequisites

Here are the important URLs in the Sandbox environment:

● Developer Console: sandbox.taxbandits.com

● API: testapi.taxbandits.com/version

Note :There are different API versions available such as 1.7.3, 1.7.1, 1.7.0, and 1.6.1. You can choose the version you prefer.

● Authentication API: testoauth.expressauth.net/v2/tbsauth

To get started with TaxBandits API, users have to sign up in our Sandbox environment. After logging in, navigate to Settings >> API Credentials to receive the following authentication keys:

  • Client ID

  • Client secret

  • User Token

Note: Do not share the keys with any individual or business.

Sample Code snippets from .NET SDK using JWT

Here is a sample code snippet to hit Form 941 Create endpoint along with the OAuth authentication logics:

To start with, set the appropriate keys in the App.config file as shown below:

*<!--URLs-->* 
<add key="OAuthApiUrl" value="https://testoauth.expressauth.net/v2/" />
<add key="PublicAPIUrlWithJWT" value="https://testapi.taxbandits.com/v1.6.0/" />
<add key="OAuthApiMethodRoute" value="tbsauth" />

*<!--JWT Credentials from Dev Console (Settings ==> API Credentials)-->*
<add key="ClientId" value="--Your ClientId here--" />
<add key="ClientSecret" value="--Your ClientSecret here--" />
<add key="UserToken" value="--Your UserToken here--" />

Retrieve classes to construct a 941 CREATE request from TaxBandits SDK. Running the .NET SDK can help you provide test values in a UI & submit them.

Upon submitting the above form, the following code snippet gets executed:

//Get URLs from App.Config
string oAuthApiUrl = Utility.GetAppSettings("OAuthApiUrl");
string apiUrl = Utility.GetAppSettings("PublicAPIUrlWithJWT");

//Call OAuth API
using (var oAuthClient = new HttpClient())
{
string oAuthRequestUri = Utility.GetAppSettings("OAuthApiMethodRoute");
oAuthClient.BaseAddress = new Uri(oAuthApiUrl);

//Generate JWS and get access token (JWT)
OAuthGenerator.GenerateJWSAndGetAccessToken(oAuthClient);

//Read OAuth API response
var response = oAuthClient.GetAsync(oAuthRequestUri).Result;
if (response != null && response.IsSuccessStatusCode)
{
var oauthApiResponse = response.Content.ReadAsAsync<AccessTokenResponse>().Result;
if (oauthApiResponse != null && oauthApiResponse.StatusCode == 200)
{
//Get Access token from OAuth API response
string accessToken = oauthApiResponse.AccessToken;
//Access token is valid for one hour. After that call OAuth API again & get new Access token.

if (!string.IsNullOrWhiteSpace(accessToken))
{
//Call TaxBandits API using the Access token
//Access token is valid for one hour. After that call OAuth API again & get new Access token.
using (var apiClient = new HttpClient())
{
//API URL to Create Form 941 Return
string requestUri = "Form941/Create";

apiClient.BaseAddress = new Uri(apiUrl);

//Construct HTTP headers
//If the Access token got expired, call OAuth API again & get a new Access token.
OAuthGenerator.ConstructHeadersWithAccessToken(apiClient, accessToken);

//Get Response
var apiResponse = apiClient.PostAsJsonAsync(requestUri, form941ReturnList).Result;
if (apiResponse != null && response.IsSuccessStatusCode)
{
//Read Response
var createResponse = apiResponse.Content.ReadAsAsync<Form941CreateReturnResponse>().Result;
if (createResponse != null)
{
responseJson = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
//Deserializing JSON (Success Response) to Form941CreateReturnResponse object
form941Response = new JavaScriptSerializer().Deserialize<Form941CreateReturnResponse>(responseJson);
if (form941Response.SubmissionId != null && form941Response.SubmissionId != Guid.Empty)
{
//Adding Form941CreateReturnResponse Response to Session
APISession.AddForm941APIResponse(form941Response);
}
}
}
else
{
var createResponse = apiResponse.Content.ReadAsAsync<Object>().Result;
responseJson = JsonConvert.SerializeObject(createResponse, Formatting.Indented);

//Deserializing JSON (Error Response) to Form941CreateReturnResponse object
form941Response = new JavaScriptSerializer().Deserialize<Form941CreateReturnResponse>(responseJson);
}
}
}
}
}
}

Here is a sample of create request JSON of Form 941. For a more detailed explanation of the JSON, fields refer to the documentation.

    {
"Form941Records": [
{
"SequenceId": "001",
"ReturnHeader": {
"ReturnType": "FORM941",
"TaxYr": "2023",
"Qtr": "Q1",
"Business": {
"BusinessId": null,
"BusinessNm": "Snowdaze LLC",
"TradeNm": " Meefto",
"IsEIN": true,
"EINorSSN": "865626415",
"Email": "sample@bodeem.com",
"ContactNm": "Alice John",
"Phone": "9894216412",
"PhoneExtn": null,
"Fax": "3236415281",
"BusinessType": "ESTE",
"SigningAuthority": {
"Name": "Tina Charles",
"Phone": "7498798798",
"BusinessMemberType": "ADMINISTRATOR"
},
"KindOfEmployer": null,
"KindOfPayer": null,
"IsBusinessTerminated": false,
"IsForeign": true,
"USAddress": {
"Address1": "1751 Kinsey Rd",
"Address2": "Main St",
"City": "Dothan",
"State": "AL",
"ZipCd": "36303"
},
"ForeignAddress": {
"Address1": "1751 Kinsey Rd",
"Address2": "Main St",
"City": "Dothan",
"ProvinceOrStateNm": "NY",
"Country": "UK",
"PostalCd": "78867789"
}
},
"IsThirdPartyDesignee": false,
"ThirdPartyDesignee": {
"Name": null,
"Phone": null,
"PIN": null
},
"SignatureDetails": {
"SignatureType": "ONLINE_SIGN_PIN",
"OnlineSignaturePIN": {
"PIN": "1262441864"
},
"ReportingAgentPIN": {
"PIN":null
},
"taxPayerPIN": {
"PIN": null
},
"Form8453EMP": null
},
"BusinessStatusDetails": {
"IsBusinessClosed": false,
"BusinessClosedDetails": {
"Name": null,
"FinalDateWagesPaid": null,
"IsForeign": false,
"USAddress": {
"Address1": "1751 Kinsey Rd",
"Address2": "Main St",
"City": "Dothan",
"State": "AL",
"ZipCd": "36303"
},
"ForeignAddress": {
"Address1": "1751 Kinsey Rd",
"Address2": "Main St",
"City": "Dothan",
"ProvinceOrStateNm": "NY",
"Country": "UK",
"PostalCd": "78867789"
}
},
"IsBusinessTransferred": false,
"BusinessTransferredDetails": {
"Name": null,
"BusinessChangeType": null,
"DateOfChange": null,
"NewBusinessType": null,
"NewBusinessName": null,
"IsForeign": true,
"USAddress": {
"Address1": null,
"Address2": null,
"City": null,
"State": null,
"ZipCd": null
},
"ForeignAddress": {
"Address1": "1751 Kinsey Rd",
"Address2": "Main St",
"City": "Dothan",
"ProvinceOrStateNm": "NY",
"Country": "UK",
"PostalCd": "78867789"
}
},
"IsSeasonalEmployer": false
}
},
"ReturnData": {
"Form941": {
"EmployeeCnt": 200,
"WagesAmt": 1264000.32,
"FedIncomeTaxWHAmt": 248000.32,
"WagesNotSubjToSSMedcrTaxInd": false,
"SocialSecurityTaxCashWagesAmt_Col1":14502.32,
"QualSickLeaveWagesAmt_Col1": 14280.64,
"QualFamilyLeaveWagesAmt_Col1": 11520.32,
"TaxableSocSecTipsAmt_Col1": 1420.36,
"TaxableMedicareWagesTipsAmt_Col1": 11512.64,
"TxblWageTipsSubjAddnlMedcrAmt_Col1": 7832.16,
"SocialSecurityTaxAmt_Col2": 1798.29,
"TaxOnQualSickLeaveWagesAmt_Col2": 885.40,
"TaxOnQualFamilyLeaveWagesAmt_Col2": 714.26,
"TaxOnSocialSecurityTipsAmt_Col2": 176.12,
"TaxOnMedicareWagesTipsAmt_Col2": 333.87,
"TaxOnWageTipsSubjAddnlMedcrAmt_Col2": 70.49,
"TotSSMdcrTaxAmt":3978.43,
"TaxOnUnreportedTips3121qAmt": 11204.62,
"TotalTaxBeforeAdjustmentAmt": 263183.37,
"CurrentQtrFractionsCentsAmt": 5200.36,
"CurrentQuarterSickPaymentAmt": 16412.28,
"CurrQtrTipGrpTermLifeInsAdjAmt": 5420.32,
"TotalTaxAfterAdjustmentAmt":290216.33,
"PayrollTaxCreditAmt": 1154.15,
"IsPayrollTaxCredit": true,
"Form8974": {
"Form8974IncomeTaxDetails": [
{
"IncomeTaxPeriodEndDate": "07-07-2021",
"IncomeTaxReturnFiledForm": "FORM1065",
"IncomeTaxReturnFiledDate": "07-07-2021",
"Form6765EIN": "006548956",
"Form6765Line44Amt": 5000,
"PreviousPeriodRemainingCreditAmt": 100,
"RemainingCredit": 4900
}
],
"Line7": 4900,
"Line8": 1798.29,
"Line9": 176.12,
"Line10": 1974.41,
"Line11": 987.21,
"PayerIndicatorType": "SECTION3121QIND",
"Line12": 987.21,
"Line13": 3912.79,
"Line14": 333.87,
"Line15": 166.94,
"Line16": 166.94,
"Line17": 1154.15
},
"NonRfdCrQualSickAndFamilyWagesB4_Apr1_2021": 0,
"NonRfdCrQualSickAndFamilyWagesAfter_Mar31_2021AndB4_Oct1_2021": 15248.63,
"TotlNonRfdCrAmt":16402.78,
"TotTaxAfterAdjustmentAndNonRfdCr": 273813.55,
"TotTaxDepositAmt":13248.12,
"RfdCrQualSickAndFamilyWagesB4_Apr1_2021": 12126.32,
"RfdCrQualSickAndFamilyWagesAfter_Mar31_2021AndB4_Oct1_2021": 1218.44,
"TotDepositAndRfdCrAmt": 26592.88,
"BalanceDueAmt": 247220.67,
"OverpaidAmt": 0,
"OverPaymentRecoveryType": null,
"QualHealthPlanExpToSickLeaveWagesB4_Apr1_2021": 1200.66,
"QualHealthPlanExpToFamilyLeaveWagesB4_Apr1_2021": 1520.64,
"QualSickLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 14282.34,
"QualHealthPlanExpToSickLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 12118.66,
"CBAToSickLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 5420.66,
"QualFamilyLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 55281.44,
"QualHealthPlanExpToFamilyLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 291864.32,
"CBAToFamilyLeaveWagesAfter_Mar31_2021AndB4_Oct1_2021": 1840.32
},
"IRSPaymentType": "EFTPS",
"IRSPayment": {
"BankRoutingNum": null,
"AccountType": null,
"BankAccountNum": null,
"Phone": null
},
"DepositScheduleType": {
"DepositorType": "MONTHLY",
"MonthlyDepositor": {
"TaxLiabilityMonth1":50000.00,
"TaxLiabilityMonth2": 173813.55,
"TaxLiabilityMonth3": 50000.00
},
"SemiWeeklyDepositor": null,
"TotalQuarterTaxLiabilityAmt": 273813.55
}
}
}
]
}

For more sample JSONs and explanations of their fields for all the supported forms, check out the documentation

For any further assistance, feel free to contact our 24*7 South Carolina-based support team at 704.684.4751 or send us an email to developer@taxbandits.com.