Developer : Tax groups

Manage applications

The /tax_groups resource contains information about a store's tax rates and the regions to which they apply. Since different types of products may be taxed at different rates within the same region, Goodsie groups rates for a particular type of product into Tax Groups.

Resource URI

/api/v1/tax_groups

Method Scope Required
GET admin
POST admin

Tax Group Properties

Property Methods Description
id GET The tax group's unique id
name GET, PUT, POST The tax group's name
taxes GET A list of the tax rates in the group. See Tax Rate Properties below

Tax Rate Properties

Property Methods Description
id GET The tax rate's unique id
country GET, PUT, POST The country to which the tax rate applies
region GET, PUT, POST The region within the country to with the tax rate applies. If null, the rate applies to the whole country
rate GET, PUT, POST The tax rate as a formatted string
rate_raw GET The tax rate in float format
on_shipping GET, POST A boolean value for whether or not shipping charges should be taxed

Subresources

Methods Path Description
GET, POST /api/v1/tax_groups/{tax_group_id} A tax group. POSTing to this endpoint allows for creation of Tax Rates. See Creating tax rules
GET, PUT, DELETE /api/v1/tax_groups/{tax_group_id}/rules/{tax_rule_id} A single tax rule

Creating tax rules

Property Method Description
rules POST A comma separated list of dictionaries for the rules where one dict represents one rule's attribues in key, value pairs. Valid properties are listed above. Please see the example below.

Example

curl -H "Authorization: Bearer ba125ac086" \
    https://goodsie.com/api/v1/tax_groups
[
    {
        "id": 1,
        "name": "Wholesale Goods",
        "taxes": [
            {
                "country": "UK",
                "id": 8,
                "rate": "3.40%",
                "rate_raw": 3.4,
                "region": null
            }
        ]
    },
    {
        "id": 3,
        "name": "Default Tax Group",
        "taxes": [
            {
                "country": "CA",
                "id": 2,
                "rate": "2.30%",
                "rate_raw": 2.3,
                "region": "Northwest Territories"
            },
            {
                "country": "US",
                "id": 5,
                "rate": "6%",
                "rate_raw": 6.0,
                "region": "MN"
            }
        ]
    }
]

Handling tax rules

All rules must be passed as arguments. Dictionaries representing existing rules must include the "id" key.

Any existing rules not included in this POST action will be deleted.

Updating an existing rule while creating a new one
curl -H "Authorization: Bearer ba125ac086" -X POST \
    -F 'rules=[{'region':'MN', 'country':'US', 'rate':4, 'id':5}, {'region':'WI', 'country':'US', 'rate':5}]' \
    https://goodsie.com/api/v1/tax_groups/3/rules
[
    {
        ... list of all rules for this tax group ...
    }
]