Taxes #
The sections below demonstrate how to solve common book-keeping problems revolving around the Tax resource.
Withholding Taxes #
Problem #
You want to create payment based (withholding) Taxes.
Solution #
Revenue Stream Categories #
You can create a withholding tax by calling the create Tax Resource endpoint with the withholding_tax attribute set to true.
Mixed Taxes
Withholding taxes cannot be combined with Transactional Taxes. This means that Line Items can either have Transactional or Withholding Taxes, but not both.
Request #
curl --location --request POST 'api.microbooks.io/books/v1/tax' \
--data-raw '{
"name": "Tax Witheld on Payment",
"code": "WHT",
"rate" : 15,
"account_id" : 2,
"withholding_tax" : true
}'
import requests
url = "https://api.microbooks.io/books/v1/tax"
body = {
"name": "Tax Witheld on Payment",
"code": "WHT",
"rate" : 15,
"account_id" : 2,
"withholding_tax" : true
}
headers = {"Authorization": "Bearer <bearer_token>"}
response = requests.request("POST", url, headers=headers, json=body)
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.microbooks.io/books/v1/tax',
'headers': {'Authorization': 'Bearer <bearer_token>'},
'body': '{
"name": "Tax Witheld on Payment",
"code": "WHT",
"rate" : 15,
"account_id" : 2,
"withholding_tax" : true
}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
$client = new Client();
$body = '{
"name": "Tax Witheld on Payment",
"code": "WHT",
"rate" : 15,
"account_id" : 2,
"withholding_tax" : true
}';
$request = new Request('POST', 'https://api.microbooks.io/books/v1/tax',
[headers' => ['Authorization' => 'Bearer <bearer_token>']],
$body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/tax");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
\"name\": \"Tax Witheld on Payment\",
\"code\": \"WHT\",
\"rate\" : 15,
\"account_id\" : 2,
\"withholding_tax\" : true
}";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);