Add Deductions to a User’s Tax Calculation

There are two ways to keep the business deductions (and consequently the tax calculations) of your User in sync with Abound®:

💡

Abound® factors the standard deduction based on filing status if set during tax calculations.

Create Expenses

Utilize the POST /users/{userId}/expenses API endpoint. The deduction value of all expenses for a given year will be summed up and applied to the expenseDeduction for tax calculations.

curl \
  --request POST \
  --url https://sandbox-api.withabound.com/v2/users/<<testUserId>>/expenses \
  --header 'Authorization: Bearer <<apiKey>>' \
  --header 'Content-Type: application/json' \
  --data '{
    "expenses": [
      {
        "amount": 139.99,
        "date": "2020-04-15",
        "description": "Tax Filing Fee",
        "expenseType": "business",
        "taxCategory": "Legal and Professional Fees"
      },
      {
        "amount": 1437.52,
        "description": "Wells Fargo Card Ccpymt",
        "date": "2020-04-10",
        "expenseType": "personal"
      },
      {
        "amount": 206.01,
        "description": "Sales Meeting",
        "date": "2020-04-12"
      }
    ]
  }'
const { default: Abound, Environment } = require("@withabound/node-sdk");

const abound = new Abound({
  appId: "<<sandbox_app_id>>",
  appSecret: "<<sandbox_app_secret>>",
  environment: Environment.SANDBOX,
  apiVersion: "v2",
});

(async () => {
  const response = await abound.expenses.create(
    "<<testUserId>>",
    [
      {
        amount: 139.99,
        date: "2020-04-15",
        description: "Tax Filing Fee",
        expenseType: "business",
        taxCategory: "Legal and Professional Fees",
      },
      {
        amount: 1437.52,
        description: "Wells Fargo Card Ccpymt",
        date: "2020-04-10",
        expenseType: "personal",
      },
      {
        amount: 206.01,
        description: "Sales Meeting",
        date: "2020-04-12",
      },
    ]
  );

  console.log(response);
})();
import requests

url = "https://sandbox-api.withabound.com/v2/users/<<testUserId>>/expenses"

payload = {"expenses": [
        {
            "amount": 139.99,
            "date": "2020-04-15",
            "description": "Tax Filing Fee",
            "expenseType": "business",
            "taxCategory": "Legal and Professional Fees"
        },
        {
            "amount": 1437.52,
            "description": "Wells Fargo Card Ccpymt",
            "date": "2020-04-10",
            "expenseType": "personal"
        },
        {
            "amount": 206.01,
            "description": "Sales Meeting",
            "date": "2020-04-12"
        }
    ]}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer <<apiKey>>"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
// import com.squareup.okhttp.*;
// import com.google.gson.JsonObject;
// import com.google.gson.JsonArray;
// import com.withabound.AboundConfig;
// import com.withabound.models.*;
// import com.withabound.resources.base*;

AboundConfig aboundConfig = new AboundConfig(
  "<<sandbox_app_id>>",
  "<<sandbox_app_secret>>",
  AboundEnvironment.SANDBOX,
  AboundApiVersion.V2
);
Abound abound = new Abound(aboundConfig);
String userId = "<<testUserId>>";
ExpenseRequest expenseRequestOne = ExpenseRequest.builder()
  .amount(139.99)
  .description("Tax Filing Fee")
  .date("2020-04-15")
  .expenseType(ExpenseType.BUSINESS)
  .taxCategory("Legal and Professional Fees")
  .build();

ExpenseRequest expenseRequestTwo = ExpenseRequest.builder()
  .amount(1437.52)
  .description("Wells Fargo Card Ccpymt")
  .date("2020-04-10")
  .expenseType(ExpenseType.PERSONAL)
  .build();

ExpenseRequest expenseRequestThree = ExpenseRequest.builder()
  .amount(206.01)
  .description("Sales Meeting")
  .date("2020-04-12")
  .build();

AboundBulkResponse<Expense> response = abound.expenses()
  .create(userId, Arrays.asList(
    expenseRequestOne,
    expenseRequestTwo,
    expenseRequstThree));

System.out.println(response.getData()); // list of created Expenses
package main

import (
    "bytes"
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://sandbox-api.withabound.com/v2/users/<<testUserId>>/expenses"

    var requestBody = []byte(`{
        "expenses": [
            {
                "amount": 139.99,
                "date": "2020-04-15",
                "description": "Tax Filing Fee",
                "expenseType": "business",
                "taxCategory": "Legal and Professional Fees"
            },
            {
                "amount": 1437.52,
                "description": "Wells Fargo Card Ccpymt",
                "date": "2020-04-10",
                "expenseType": "personal"
            },
            {
                "amount": 206.01,
                "description": "Sales Meeting",
                "date": "2020-04-12"
            }
        ]
    }`)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))

    req.Header.Add("Accept", "application/json")
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "Bearer <<apiKey>>")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}
// using RestSharp;

var client = new RestClient("https://sandbox-api.withabound.com/v2/users/<<testUserId>>/expenses");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer <<apiKey>>");
request.AddJsonBody(new {
  expenses = new[] {
    new {
      amount = 139.99,
      date = "2020-04-15",
      description = "Tax Filing Fee",
      expenseType = "business",
      taxCategory = "Legal and Professional Fees"
    },
    new {
      amount = 1437.52,
      description = "Wells Fargo Card Ccpymt",
      date = "2020-04-10",
      expenseType = "personal"
    },
    new {
      amount = 206.01,
      description = "Sales Meeting",
      date = "2020-04-12"
    }
  }
});
IRestResponse response = client.Execute(request);
require 'uri'
require 'net/http'
require 'openssl'
require 'json'

url = URI("https://sandbox-api.withabound.com/v2/users/<<testUserId>>/expenses")
requestBody = {
  expenses: [
    {
      amount: 139.99,
      date: "2020-04-15",
      description: "Tax Filing Fee",
      expenseType: "business",
      taxCategory: "Legal and Professional Fees"
    },
    {
      amount: 1437.52,
      description: "Wells Fargo Card Ccpymt",
      date: "2020-04-10",
      expenseType: "personal"
    },
    {
      amount: 206.01,
      description: "Sales Meeting",
      date: "2020-04-12"
    }
  ]
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer <<apiKey>>'
request.body = requestBody.to_json

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "expenseId": "expenseId_testB1FBA298F0154D1906F18AF8C8D97FDCBD28",
      "amount": 139.99,
      "description": "Tax Filing Fee",
      "date": "2020-04-15",
      "expenseType": "business",
      "taxCategory": "Legal and Professional Fees",
      "deductionAmount": 139.99,
      "predictions": {}
    },
    {
      "expenseId": "expenseId_test495DB2C7F905E5DDDFD03B12029D8FB99084",
      "amount": 1437.52,
      "description": "Wells Fargo Card Ccpymt",
      "date": "2020-04-10",
      "expenseType": "personal",
      "taxCategory": null,
      "deductionAmount": 0,
      "predictions": {
        "taxCategoryPredictionScores": {
          "Advertising and Marketing": 0.05218,
          "Car and Truck": 0.0937,
          "Commission and Fees": 0.00056,
          "Contract Labor": 0.00352,
          "Depletion": 6e-05,
          "Depreciation": 2e-05,
          "Employee Benefits Program": 0.00624,
          "Insurance": 0.06961,
          "Interest (Mortgage)": 0.00012,
          "Interest (Other)": 0.00326,
          "Legal and Professional Fees": 0.12655,
          "Office Expense": 0.041,
          "Pension and Profit Sharing": 0.00125,
          "Rent (Vehicles and Equipment)": 0.00051,
          "Rent (Business Property)": 0.00777,
          "Repairs and Maintenance": 0.00749,
          "Supplies": 0.0228,
          "Taxes and Licenses": 0.0025,
          "Travel": 0.00388,
          "Meals": 0.37615,
          "Utilities": 0.10757,
          "Wages": 0.00204,
          "Other": 0.07123
        }
      }
    },
    {
      "expenseId": "expenseId_testf86dd836000a95e298aa418634718ffad6ec",
      "amount": 206.01,
      "description": "Sales Meeting",
      "date": "2020-04-12",
      "expenseType": "business",
      "taxCategory": "Meals",
      "deductionAmount": 103,
      "predictions": {
        "expenseTypePredictionScores": {
          "0": 0.007482942659408,
          "1": 0.992517054080963
        },
        "taxCategoryPredictionScores": {
          "Advertising and Marketing": 0.05218,
          "Car and Truck": 0.0937,
          "Commission and Fees": 0.00056,
          "Contract Labor": 0.00352,
          "Depletion": 6e-05,
          "Depreciation": 2e-05,
          "Employee Benefits Program": 0.00624,
          "Insurance": 0.06961,
          "Interest (Mortgage)": 0.00012,
          "Interest (Other)": 0.00326,
          "Legal and Professional Fees": 0.12655,
          "Office Expense": 0.041,
          "Pension and Profit Sharing": 0.00125,
          "Rent (Vehicles and Equipment)": 0.00051,
          "Rent (Business Property)": 0.00777,
          "Repairs and Maintenance": 0.00749,
          "Supplies": 0.0228,
          "Taxes and Licenses": 0.0025,
          "Travel": 0.00388,
          "Meals": 0.37615,
          "Utilities": 0.10757,
          "Wages": 0.00204,
          "Other": 0.07123
        }
      }
    }
  ]
}

Manually set expenseDeduction when calculating taxes

You can call the PUT /users/{userId}/taxes/{year} API endpoint and include the expenseDeduction field.

FieldDescription
expenseDeductionThe total business expense deduction for this user. Most business expenses are deducted at 100% of the expense value. Note: different categories, such as "Meals & Entertainment", are deducted at a different rate.
curl \
  --request PUT \
  --url https://sandbox-api.withabound.com/v2/users/<<testUserId>>/taxes/2020 \
  --header 'Authorization: Bearer <<apiKey>>' \
  --header 'Content-Type: application/json' \
  --data '{
    "taxes": {
      "expenseDeduction": 15321.99
    }
  }'
const { default: Abound, Environment } = require("@withabound/node-sdk");

const abound = new Abound({
  appId: "<<sandbox_app_id>>",
  appSecret: "<<sandbox_app_secret>>",
  environment: Environment.SANDBOX,
  apiVersion: "v2",
});

(async () => {
  const response = await abound.taxes.calculate(
    "<<testUserId>>",
    "2020",
    {
      expenseDeduction: 15321.99,
    }
  );
  
  console.log(response);
})();
import requests

url = "https://sandbox-api.withabound.com/v2/users/<<testUserId>>/taxes/2020"

payload = {"taxes": {"expenseDeduction": 15321.99}}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer <<apiKey>>"
}

response = requests.request("PUT", url, json=payload, headers=headers)

print(response.text)
//import com.withabound.AboundConfig;
//import com.withabound.models.*;
//import  com.withabound.resources.base*;

AboundConfig aboundConfig = new AboundConfig(
  "<<sandbox_app_id>>",
  "<<sandbox_app_secret>>",
  AboundEnvironment.SANDBOX,
  AboundApiVersion.V2
);
Abound abound = new Abound(aboundConfig);
String userId = "<<testUserId>>";
String year = "2020";
TaxRequest taxUpdates = TaxRequest.builder()
  .expenseDeduction(15321.99)
  .build();

AboundResponse<Tax> response = abound.taxes().calculate(userId, year, taxUpdates);

System.out.println(response.getData().getEffectiveTaxRate());
package main

import (
    "bytes"
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://sandbox-api.withabound.com/v2/users/<<testUserId>>/taxes/2020"

    var requestBody = []byte(`{
        "taxes": {
            "expenseDeduction": 15321.99
        }
    }`)

    req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(requestBody))

    req.Header.Add("Accept", "application/json")
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "Bearer <<apiKey>>")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}
// using RestSharp;

var client = new RestClient("https://sandbox-api.withabound.com/v2/users/<<testUserId>>/taxes/2020");
var request = new RestRequest(Method.PUT);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer <<apiKey>>");
request.AddJsonBody(new {
  taxes = new {
    expenseDeduction = 15321.99
  }
});
IRestResponse response = client.Execute(request);
require 'uri'
require 'net/http'
require 'openssl'
require 'json'

url = URI("https://sandbox-api.withabound.com/v2/users/<<testUserId>>/taxes/2020")
requestBody = {
  taxes: {
    expenseDeduction: 15321.99
  }
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer <<apiKey>>'
request.body = requestBody.to_json

response = http.request(request)
puts response.read_body

The response from this API call is the same as detailed in the Calculate Taxes Owed for a Specific User guide.


Did this page help you?