taxjar-go: github.com/taxjar/taxjar-go Index | Examples | Files | Directories

package taxjar

import "github.com/taxjar/taxjar-go"

Package taxjar - Official Go API client from TaxJar (https://www.taxjar.com)

For more information, see our:

• Go Quickstart Guide (https://developers.taxjar.com/api/guides/go/)

• API docs (https://developers.taxjar.com/api/reference/?go)

• API Guides (https://developers.taxjar.com/api/guides)

• Integration Guides (https://developers.taxjar.com/integrations)

• README (https://github.com/taxjar/taxjar-go/blob/master/README.md)

Index

Examples

Package Files

Categories.go Client.go CreateCustomer.go CreateOrder.go CreateRefund.go DeleteCustomer.go DeleteOrder.go DeleteRefund.go Error.go ListCustomers.go ListOrders.go ListRefunds.go NexusRegions.go RatesForLocation.go ShowCustomer.go ShowOrder.go ShowRefund.go SummaryRates.go TaxForOrder.go TaxForOrder_types.go UpdateCustomer.go UpdateOrder.go UpdateRefund.go Validate.go ValidateAddress.go request.go request_helpers.go version.go

Constants

const DefaultAPIURL = "https://api.taxjar.com"

DefaultAPIURL ("https://api.taxjar.com") is the default base API URL for each request to TaxJar․

Override this by setting `Config.APIURL` to a different string․

const DefaultAPIVersion = "v2"

DefaultAPIVersion ("v2") is the default TaxJar API version․

Override this by setting `Config.APIVersion` to a different string․

const DefaultTimeout = 30 * time.Second

DefaultTimeout for requests is `30 * time.Second`․

Override this by setting `Config.Timeout` to a different time value․

const SandboxAPIURL = "https://api.sandbox.taxjar.com"

SandboxAPIURL ("https://api.sandbox.taxjar.com") is the base API URL to send requests to TaxJar's sandbox environment․

Use by setting `Config.APIURL` to `taxjar.SandboxAPIURL`․

Please note that TaxJar's sandbox environment requires a TaxJar Plus account (https://www.taxjar.com/plus/)․

See https://developers.taxjar.com/api/reference/?go#sandbox-environment for more details․

Variables

var DefaultTransport = &http.Transport{
    DialContext: (&net.Dialer{
        Timeout:   10 * time.Second,
        KeepAlive: 10 * time.Second,
    }).DialContext,
    TLSHandshakeTimeout:   10 * time.Second,
    ExpectContinueTimeout: 4 * time.Second,
    ResponseHeaderTimeout: 3 * time.Second,
}

DefaultTransport is the default `*http.Transport` for requests․

Override this by setting `Config.Transport` to a different `*http.Transport` (from net/http package - https://godoc.org/net/http#Transport)․

type Address Uses

type Address struct {
    Country string `json:"country"`
    State   string `json:"state"`
    Zip     string `json:"zip"`
    City    string `json:"city"`
    Street  string `json:"street"`
}

Address is the structure for an address returned from `ValidateAddress` within `ValidateAddressResponse.Addresses`․

type Breakdown Uses

type Breakdown struct {
    TaxableAmount                 float64             `json:"taxable_amount"`
    TaxCollectable                float64             `json:"tax_collectable"`
    CombinedTaxRate               float64             `json:"combined_tax_rate"`
    StateTaxableAmount            float64             `json:"state_taxable_amount"`
    StateTaxRate                  float64             `json:"state_tax_rate"`
    StateTaxCollectable           float64             `json:"state_tax_collectable"`
    CountyTaxableAmount           float64             `json:"county_taxable_amount"`
    CountyTaxRate                 float64             `json:"county_tax_rate"`
    CountyTaxCollectable          float64             `json:"county_tax_collectable"`
    CityTaxableAmount             float64             `json:"city_taxable_amount"`
    CityTaxRate                   float64             `json:"city_tax_rate"`
    CityTaxCollectable            float64             `json:"city_tax_collectable"`
    SpecialDistrictTaxableAmount  float64             `json:"special_district_taxable_amount"`
    SpecialTaxRate                float64             `json:"special_tax_rate"`
    SpecialDistrictTaxCollectable float64             `json:"special_district_tax_collectable"`
    Shipping                      Shipping            `json:"shipping"`
    LineItems                     []LineItemBreakdown `json:"line_items"`
    // Canada
    GSTTaxableAmount float64 `json:"gst_taxable_amount"`
    GSTTaxRate       float64 `json:"gst_tax_rate"`
    GST              float64 `json:"gst"`
    PSTTaxableAmount float64 `json:"pst_taxable_amount"`
    PSTTaxRate       float64 `json:"pst_tax_rate"`
    PST              float64 `json:"pst"`
    QSTTaxableAmount float64 `json:"qst_taxable_amount"`
    QSTTaxRate       float64 `json:"qst_tax_rate"`
    QST              float64 `json:"qst"`
    // Other International Attributes
    CountryTaxableAmount  float64 `json:"country_taxable_amount"`
    CountryTaxRate        float64 `json:"country_tax_rate"`
    CountryTaxCollectable float64 `json:"country_tax_collectable"`
}

Breakdown is the structure for `TaxForOrderResponse.Tax.Breakdown`․

type CategoriesResponse Uses

type CategoriesResponse struct {
    Categories []Category `json:"categories"`
}

CategoriesResponse is the structure returned from `Categories`․

Access TaxJar's product tax categories with `CategoriesResponse.Categories`․

type Category Uses

type Category struct {
    Name           string `json:"name"`
    ProductTaxCode string `json:"product_tax_code"`
    Description    string `json:"description"`
}

Category is the structure for a product tax category returned from `Categories` within `CategoriesResponse.Categories`․

type Config Uses

type Config struct {
    APIURL     string // default: "https://api.taxjar.com"
    APIKey     string
    APIVersion string // default: "v2"
    Headers    map[string]interface{}
    HTTPClient *http.Client    // default: `&http.Client{}` (from net/http package - https://godoc.org/net/http#Client)
    Timeout    time.Duration   // default: `30 * time.Second`
    Transport  *http.Transport /* default:
    &http.Transport{
    	DialContext: (&net.Dialer{
    		Timeout:   10 * time.Second,
    		KeepAlive: 10 * time.Second,
    	}).DialContext,
    	TLSHandshakeTimeout:   10 * time.Second,
    	ExpectContinueTimeout: 4 * time.Second,
    	ResponseHeaderTimeout: 3 * time.Second,
    }*/
}

Config is the structure for configuring a `taxjar` client․ Pass a `Config` to `NewClient` to instantiate a client․

See below for default values․

func NewClient Uses

func NewClient(config ...Config) Config

NewClient instantiates a new `taxjar` client․

Configure the client by passing a `Config` to `NewClient` or by setting configuration values such as `APIURL`, `APIKey`, `APIVersion`, `Headers`, `HTTPClient`, `Timeout`, and `Transport` after instantiation․

NewClient returns a client (type `Config`), on which you can call other methods to interact with TaxJar's API such as `Categories`, `TaxForOrder`, `CreateOrder`, etc․

See our Go Quickstart Guide for more usage details and background: https://developers.taxjar.com/api/guides/go/#go-quickstart

Code:

// Configure during instantiation
client := taxjar.NewClient(taxjar.Config{
    APIKey: os.Getenv("TAXJAR_API_KEY"),
})

// Or configure after instantiation
client = taxjar.NewClient()
client.APIKey = os.Getenv("TAXJAR_API_KEY")

func (*Config) Categories Uses

func (client *Config) Categories() (*CategoriesResponse, error)

Categories lists all TaxJar product tax categories to be used for products that are either exempt from sales tax in some jurisdictions or are taxed at reduced rates․

See https://developers.taxjar.com/api/reference/?go#categories for more details․

Code:

res, err := client.Categories()
if err != nil {
    // handle error
}
fmt.Printf("Categories %+v", res.Categories)

func (*Config) CreateCustomer Uses

func (client *Config) CreateCustomer(params CreateCustomerParams) (*CreateCustomerResponse, error)

CreateCustomer creates a new customer in TaxJar․ Use the newly created customer's `CustomerID` when calculating tax with `TaxForOrder` or when creating or updating transactions․

See https://developers.taxjar.com/api/reference/?go#post-create-a-customer for more details․

Code:

res, err := client.CreateCustomer(taxjar.CreateCustomerParams{
    CustomerID:    "123",
    ExemptionType: "wholesale",
    Name:          "Initech",
    ExemptRegions: []taxjar.ExemptRegion{
        {
            Country: "US",
            State:   "TX",
        },
    },
    Country: "US",
    State:   "TX",
    Zip:     "78744",
    City:    "Austin",
    Street:  "4120 Freidrich Ln",
})
if err != nil {
    // handle error
}
fmt.Printf("CreateCustomer %+v", res.Customer)

func (*Config) CreateOrder Uses

func (client *Config) CreateOrder(params CreateOrderParams) (*CreateOrderResponse, error)

CreateOrder creates a new order in TaxJar․

See https://developers.taxjar.com/api/reference/?go#post-create-an-order-transaction for more details․

Code:

res, err := client.CreateOrder(taxjar.CreateOrderParams{
    TransactionID:   "13579-246810",
    TransactionDate: "2015/09/08",
    ToCountry:       "US",
    ToZip:           "10019",
    ToState:         "NY",
    ToCity:          "New York",
    ToStreet:        "1697 Broadway",
    Amount:          36.21,
    Shipping:        5,
    SalesTax:        0,
    LineItems: []taxjar.OrderLineItem{
        {
            ID:                "1",
            Quantity:          1,
            ProductIdentifier: "12-34243-9",
            Description:       "Fuzzy Sweater",
            ProductTaxCode:    "20010",
            UnitPrice:         36.72,
            Discount:          5.51,
            SalesTax:          0,
        },
    },
})
if err != nil {
    // handle error
}
fmt.Printf("CreateOrder %+v", res.Order)

func (*Config) CreateRefund Uses

func (client *Config) CreateRefund(params CreateRefundParams) (*CreateRefundResponse, error)

CreateRefund creates a new refund in TaxJar․

See https://developers.taxjar.com/api/reference/?go#post-create-a-refund-transaction for more details․

Code:

res, err := client.CreateRefund(taxjar.CreateRefundParams{
    TransactionID:          "13579-246810-refund",
    TransactionReferenceID: "13579-246810",
    TransactionDate:        "2015/09/08",
    ToCountry:              "US",
    ToZip:                  "10019",
    ToState:                "NY",
    ToCity:                 "New York",
    ToStreet:               "1697 Broadway",
    Amount:                 -116.51,
    Shipping:               -0,
    SalesTax:               -10.74,
    LineItems: []taxjar.RefundLineItem{
        {
            ID:                "1",
            Quantity:          1,
            ProductIdentifier: "12-34243-9",
            Description:       "Fuzzy Sweater",
            ProductTaxCode:    "20010",
            UnitPrice:         -0,
            Discount:          -0,
            SalesTax:          -0,
        },
        {
            ID:                "2",
            Quantity:          1,
            ProductIdentifier: "12-34245-8",
            Description:       "TaxJar Designer T-shirt",
            ProductTaxCode:    "20010",
            UnitPrice:         -111,
            SalesTax:          -9.85,
        },
    },
})
if err != nil {
    // handle error
}
fmt.Printf("CreateRefund %+v", res.Refund)

func (*Config) DeleteCustomer Uses

func (client *Config) DeleteCustomer(customerID string) (*DeleteCustomerResponse, error)

DeleteCustomer deletes a customer in TaxJar․

See https://developers.taxjar.com/api/reference/?go#delete-delete-a-customer for more details․

Code:

res, err := client.DeleteCustomer("123")
if err != nil {
    // handle error
}
fmt.Printf("DeleteCustomer %+v", res.Customer)

func (*Config) DeleteOrder Uses

func (client *Config) DeleteOrder(transactionID string, params ...DeleteOrderParams) (*DeleteOrderResponse, error)

DeleteOrder deletes an order in TaxJar․

See https://developers.taxjar.com/api/reference/?go#delete-delete-an-order-transaction for more details․

Code:

res, err := client.DeleteOrder("13579-246810")
if err != nil {
    fmt.Println(err)
}
fmt.Printf("DeleteOrder %+v", res.Order)

func (*Config) DeleteRefund Uses

func (client *Config) DeleteRefund(transactionID string, params ...DeleteRefundParams) (*DeleteRefundResponse, error)

DeleteRefund deletes a refund in TaxJar․

See https://developers.taxjar.com/api/reference/?go#delete-delete-a-refund-transaction for more details․

Code:

res, err := client.DeleteRefund("13579-246810-refund")
if err != nil {
    // handle error
}
fmt.Printf("DeleteRefund %+v", res.Refund)

func (*Config) ListCustomers Uses

func (client *Config) ListCustomers() (*ListCustomersResponse, error)

ListCustomers lists existing customer IDs in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-list-customers for more details․

Code:

res, err := client.ListCustomers()
if err != nil {
    // handle error
}
fmt.Printf("ListCustomers %+v", res.Customers)

func (*Config) ListOrders Uses

func (client *Config) ListOrders(params ListOrdersParams) (*ListOrdersResponse, error)

ListOrders lists existing order IDs in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-list-order-transactions for more details․

Code:

res, err := client.ListOrders(taxjar.ListOrdersParams{
    FromTransactionDate: "2015/09/01",
    ToTransactionDate:   "2015/09/30",
})
if err != nil {
    fmt.Println(err)
}
fmt.Printf("ListOrders %+v", res.Orders)

func (*Config) ListRefunds Uses

func (client *Config) ListRefunds(params ListRefundsParams) (*ListRefundsResponse, error)

ListRefunds lists existing refund IDs in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-list-refund-transactions for more details․

Code:

res, err := client.ListRefunds(taxjar.ListRefundsParams{
    FromTransactionDate: "2015/09/01",
    ToTransactionDate:   "2015/09/30",
})
if err != nil {
    // handle error
}
fmt.Printf("ListRefunds %+v", res.Refunds)

func (*Config) NexusRegions Uses

func (client *Config) NexusRegions() (*NexusRegionsResponse, error)

NexusRegions lists existing nexus locations for a TaxJar account․

See https://developers.taxjar.com/api/reference/?go#get-list-nexus-regions for more details․

Code:

res, err := client.NexusRegions()
if err != nil {
    // handle error
}
fmt.Printf("NexusRegions %+v", res.Regions)

func (*Config) RatesForLocation Uses

func (client *Config) RatesForLocation(zip string, params ...RatesForLocationParams) (*RatesForLocationResponse, error)

RatesForLocation shows the sales tax rates for a given location․

Please note `RatesForLocation` only returns the full combined rate for a given location․ It does not support nexus determination, sourcing based on a ship from and ship to address, shipping taxability, product exemptions, customer exemptions, or sales tax holidays․

We recommend using `TaxForOrder` to accurately calculate sales tax for an order․

See https://developers.taxjar.com/api/reference/?go#get-show-tax-rates-for-a-location for more details.

Code:

res, err := client.RatesForLocation("94043", taxjar.RatesForLocationParams{
    Country: "US",
    State:   "CA",
    City:    "Mountain View",
    Street:  "311 Moffett Blvd",
})
if err != nil {
    // handle error
}
fmt.Printf("RatesForLocation %+v", res.Rate)

func (*Config) ShowCustomer Uses

func (client *Config) ShowCustomer(customerID string) (*ShowCustomerResponse, error)

ShowCustomer shows an existing customer in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-show-a-customer for more details․

Code:

res, err := client.ShowCustomer("123")
if err != nil {
    // handle error
}
fmt.Printf("ShowCustomer %+v", res.Customer)

func (*Config) ShowOrder Uses

func (client *Config) ShowOrder(transactionID string, params ...ShowOrderParams) (*ShowOrderResponse, error)

ShowOrder shows an existing order in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-show-an-order-transaction for more details․

Code:

res, err := client.ShowOrder("13579-246810")
if err != nil {
    // handle error
}
fmt.Printf("ShowOrder %+v", res.Order)

func (*Config) ShowRefund Uses

func (client *Config) ShowRefund(transactionID string, params ...ShowRefundParams) (*ShowRefundResponse, error)

ShowRefund shows an existing refund in TaxJar․

See https://developers.taxjar.com/api/reference/?go#get-show-a-refund-transaction for more details․

Code:

res, err := client.ShowRefund("13579-246810-refund")
if err != nil {
    // handle error
}
fmt.Printf("ShowRefund %+v", res.Refund)

func (*Config) SummaryRates Uses

func (client *Config) SummaryRates() (*SummaryRatesResponse, error)

SummaryRates retrieves minimum and average sales tax rates by region, which you can use as a backup․

See https://developers.taxjar.com/api/reference/?go#get-summarize-tax-rates-for-all-regions for more details․

Code:

res, err := client.SummaryRates()
if err != nil {
    // handle error
}
fmt.Printf("SummaryRates %+v", res.SummaryRates)

func (*Config) TaxForOrder Uses

func (client *Config) TaxForOrder(params TaxForOrderParams) (*TaxForOrderResponse, error)

TaxForOrder shows the sales tax that should be collected for a given order․

See https://developers.taxjar.com/api/reference/?go#post-calculate-sales-tax-for-an-order for more details․

Code:

res, err := client.TaxForOrder(taxjar.TaxForOrderParams{
    FromCountry: "US",
    FromZip:     "92093",
    FromState:   "CA",
    FromCity:    "La Jolla",
    FromStreet:  "9500 Gilman Drive",
    ToCountry:   "US",
    ToZip:       "90002",
    ToState:     "CA",
    ToCity:      "Los Angeles",
    ToStreet:    "1335 E 103rd St",
    Amount:      15,
    Shipping:    1.5,
    LineItems: []taxjar.TaxLineItem{
        {
            ID:             "1",
            Quantity:       1,
            ProductTaxCode: "20010",
            UnitPrice:      15,
            Discount:       0,
        },
    },
})
if err != nil {
    // handle error
}
fmt.Printf("TaxForOrder %+v", res.Tax)

func (*Config) UpdateCustomer Uses

func (client *Config) UpdateCustomer(params UpdateCustomerParams) (*UpdateCustomerResponse, error)

UpdateCustomer updates an existing customer in TaxJar․

Use the updated customer's `CustomerID` when calculating tax with TaxForOrder or when creating or updating transactions․

See https://developers.taxjar.com/api/reference/?go#put-update-a-customer for more details․

Code:

res, err := client.UpdateCustomer(taxjar.UpdateCustomerParams{
    CustomerID:    "123",
    ExemptionType: "non_exempt",
    Name:          "Initech",
})
if err != nil {
    fmt.Println(err)
}
fmt.Printf("UpdateCustomer %+v", res.Customer)

func (*Config) UpdateOrder Uses

func (client *Config) UpdateOrder(params UpdateOrderParams) (*UpdateOrderResponse, error)

UpdateOrder updates an existing order in TaxJar․

See https://developers.taxjar.com/api/reference/?go#put-update-an-order-transaction for more details․

Code:

res, err := client.UpdateOrder(taxjar.UpdateOrderParams{
    TransactionID: "13579-246810",
    Amount:        152.72,
    Shipping:      10,
    SalesTax:      10.74,
    LineItems: []taxjar.OrderLineItem{
        {
            ID:                "1",
            Quantity:          1,
            ProductIdentifier: "12-34243-9",
            Description:       "Fuzzy Sweater",
            ProductTaxCode:    "20010",
            UnitPrice:         36.72,
            Discount:          5.51,
            SalesTax:          0,
        },
        {
            ID:                "2",
            Quantity:          1,
            ProductIdentifier: "12-34245-8",
            Description:       "TaxJar Designer T-shirt",
            ProductTaxCode:    "20010",
            UnitPrice:         111,
            SalesTax:          9.85,
        },
    },
})
if err != nil {
    // handle error
}
fmt.Printf("UpdateOrder %+v", res.Order)

func (*Config) UpdateRefund Uses

func (client *Config) UpdateRefund(params UpdateRefundParams) (*UpdateRefundResponse, error)

UpdateRefund updates an existing refund in TaxJar․

See https://developers.taxjar.com/api/reference/?go#put-update-a-refund-transaction for more details․

Code:

res, err := client.UpdateRefund(taxjar.UpdateRefundParams{
    TransactionID:          "13579-246810-refund",
    TransactionReferenceID: "13579-246810",
    Shipping:               -5,
})
if err != nil {
    // handle error
}
fmt.Printf("UpdateRefund %+v", res.Refund)

func (*Config) Validate Uses

func (client *Config) Validate(params ValidateParams) (*ValidateResponse, error)

Validate validates a VAT identification number with VIES (http://ec.europa.eu/taxation_customs/vies/)․

See https://developers.taxjar.com/api/reference/?go#get-validate-a-vat-number for more details․

Code:

res, err := client.Validate(taxjar.ValidateParams{
    VAT: "FR40303265045",
})
if err != nil {
    // handle error
}
fmt.Printf("Validate %+v", res.Validation)

func (*Config) ValidateAddress Uses

func (client *Config) ValidateAddress(params ValidateAddressParams) (*ValidateAddressResponse, error)

ValidateAddress validates a customer address and returns back a collection of address matches․

Address validation requires a TaxJar Plus subscription (https://www.taxjar.com/plus/)․

See https://developers.taxjar.com/api/reference/?go#post-validate-an-address for more details․

Code:

res, err := client.ValidateAddress(taxjar.ValidateAddressParams{
    Country: "US",
    State:   "AZ",
    Zip:     "85297",
    City:    "Gilbert",
    Street:  "3301 South Greenfield Rd",
})
if err != nil {
    // handle error
}
fmt.Printf("ValidateAddress %+v", res.Addresses)

type CreateCustomerParams Uses

type CreateCustomerParams struct {
    CustomerID    string         `json:"customer_id,omitempty"`
    ExemptionType string         `json:"exemption_type,omitempty"`
    Name          string         `json:"name,omitempty"`
    ExemptRegions []ExemptRegion `json:"exempt_regions,omitempty"`
    Country       string         `json:"country,omitempty"`
    State         string         `json:"state,omitempty"`
    Zip           string         `json:"zip,omitempty"`
    City          string         `json:"city,omitempty"`
    Street        string         `json:"street,omitempty"`
}

CreateCustomerParams should be passed to `CreateCustomer` to create a customer․

type CreateCustomerResponse Uses

type CreateCustomerResponse struct {
    Customer Customer `json:"customer"`
}

CreateCustomerResponse is the structure returned from `CreateCustomer`․

Access the created customer with `CreateCustomerResponse.Customer`․

type CreateOrderParams Uses

type CreateOrderParams struct {
    TransactionID   string          `json:"transaction_id,omitempty"`
    TransactionDate string          `json:"transaction_date,omitempty"`
    Provider        string          `json:"provider,omitempty"`
    FromCountry     string          `json:"from_country,omitempty"`
    FromZip         string          `json:"from_zip,omitempty"`
    FromState       string          `json:"from_state,omitempty"`
    FromCity        string          `json:"from_city,omitempty"`
    FromStreet      string          `json:"from_street,omitempty"`
    ToCountry       string          `json:"to_country,omitempty"`
    ToZip           string          `json:"to_zip,omitempty"`
    ToState         string          `json:"to_state,omitempty"`
    ToCity          string          `json:"to_city,omitempty"`
    ToStreet        string          `json:"to_street,omitempty"`
    Amount          float64         `json:"amount"`
    Shipping        float64         `json:"shipping"`
    SalesTax        float64         `json:"sales_tax"`
    CustomerID      string          `json:"customer_id,omitempty"`
    ExemptionType   string          `json:"exemption_type,omitempty"`
    LineItems       []OrderLineItem `json:"line_items,omitempty"`
}

CreateOrderParams should be passed to `CreateOrder` to create an order․

type CreateOrderResponse Uses

type CreateOrderResponse struct {
    Order Order `json:"order"`
}

CreateOrderResponse is the structure returned from `CreateOrder`․

Access the created order with `CreateOrderResponse.Order`․

type CreateRefundParams Uses

type CreateRefundParams struct {
    TransactionID          string           `json:"transaction_id,omitempty"`
    TransactionReferenceID string           `json:"transaction_reference_id,omitempty"`
    TransactionDate        string           `json:"transaction_date,omitempty"`
    Provider               string           `json:"provider,omitempty"`
    FromCountry            string           `json:"from_country,omitempty"`
    FromZip                string           `json:"from_zip,omitempty"`
    FromState              string           `json:"from_state,omitempty"`
    FromCity               string           `json:"from_city,omitempty"`
    FromStreet             string           `json:"from_street,omitempty"`
    ToCountry              string           `json:"to_country,omitempty"`
    ToZip                  string           `json:"to_zip,omitempty"`
    ToState                string           `json:"to_state,omitempty"`
    ToCity                 string           `json:"to_city,omitempty"`
    ToStreet               string           `json:"to_street,omitempty"`
    Amount                 float64          `json:"amount"`
    Shipping               float64          `json:"shipping"`
    SalesTax               float64          `json:"sales_tax"`
    CustomerID             string           `json:"customer_id,omitempty"`
    ExemptionType          string           `json:"exemption_type,omitempty"`
    LineItems              []RefundLineItem `json:"line_items,omitempty"`
}

CreateRefundParams should be passed to `CreateRefund` to create a refund․

type CreateRefundResponse Uses

type CreateRefundResponse struct {
    Refund Refund `json:"refund"`
}

CreateRefundResponse is the structure returned from `CreateRefund`․

Access the created refund with `CreateRefundResponse.Refund`․

type Customer Uses

type Customer struct {
    CustomerID    string         `json:"customer_id"`
    ExemptionType string         `json:"exemption_type"`
    ExemptRegions []ExemptRegion `json:"exempt_regions"`
    Name          string         `json:"name"`
    Country       string         `json:"country"`
    State         string         `json:"state"`
    Zip           string         `json:"zip"`
    City          string         `json:"city"`
    Street        string         `json:"street"`
}

Customer is the structure for a customer returned within `CreateCustomerResponse`, `UpdateCustomerResponse`, `ShowCustomerResponse`, and `DeleteCustomerResponse`․

type DeleteCustomerResponse Uses

type DeleteCustomerResponse struct {
    CreateCustomerResponse
}

DeleteCustomerResponse is the structure returned from `DeleteCustomer`․

Access the deleted customer with `DeleteCustomerResponse.Customer`․

type DeleteOrderParams Uses

type DeleteOrderParams struct {
    Provider string `url:"provider,omitempty"`
}

DeleteOrderParams should be passed to `DeleteOrder` to delete an order․

type DeleteOrderResponse Uses

type DeleteOrderResponse struct {
    Order Order `json:"order"`
}

DeleteOrderResponse is the structure returned from `DeleteOrder`․

Access the deleted order with `DeleteOrderResponse.Order`․

type DeleteRefundParams Uses

type DeleteRefundParams struct {
    Provider string `url:"provider,omitempty"`
}

DeleteRefundParams should be passed to `DeleteRefund` to delete a refund․

type DeleteRefundResponse Uses

type DeleteRefundResponse struct {
    Refund Refund `json:"refund"`
}

DeleteRefundResponse is the structure returned from `DeleteRefund`․

Access the deleted refund with `DeleteRefundResponse.Refund`․

type Error Uses

type Error struct {
    Err    string `json:"error"`
    Detail string `json:"detail"`
    Status int    `json:"status"`
}

Error is the custom error type returned in the second return value of each TaxJar API method (e.g., `TaxForOrder`)․

See here for example error handling that extracts `Err`, `Detail`, and `Status` fields and displays a stack trace: https://github.com/taxjar/taxjar-go/blob/master/README.md#error-handling

Code:

client := taxjar.NewClient(taxjar.Config{
    APIKey: "INVALID_API_KEY",
})
res, err := client.TaxForOrder(taxjar.TaxForOrderParams{
    FromCountry: "US",
    FromZip:     "94025",
    FromState:   "CA",
    FromCity:    "Menlo Park",
    FromStreet:  "2825 Sand Hill Rd",
    ToCountry:   "US",
    ToZip:       "94303",
    ToState:     "CA",
    ToCity:      "Palo Alto",
    ToStreet:    "5230 Newell Road",
    Amount:      267.9,
    Shipping:    0,
    LineItems: []taxjar.TaxLineItem{
        {
            ID:             "1",
            Quantity:       1,
            ProductTaxCode: "19005",
            UnitPrice:      535.8,
            Discount:       267.9,
        },
    },
})
if err != nil {
    fmt.Println(err) // taxjar: 401 Unauthorized - Not Authorized for route 'POST /v2/taxes'
} else {
    fmt.Println(res.Tax)
}
// or extract more information by asserting to `*taxjar.Error`
if err := err.(*taxjar.Error); err != nil {
    fmt.Println(err.Status)                 // 401
    fmt.Println(err.Err)                    // Unauthorized
    fmt.Println(err.Detail)                 // Not authorized for route `POST /v2/taxes'
    fmt.Printf("%+v", errors.Wrap(err, "")) // Stack trace:
    // taxjar: 401 Unauthorized - Not Authorized for route 'POST /v2/taxes'
    //
    // main.main
    //         /Path/to/your/file.go:292
    // runtime.main
    //         /usr/local/go/src/runtime/proc.go:200
    // runtime.goexit
    //         /usr/local/go/src/runtime/asm_amd64.s:1337
} else {
    fmt.Println(res.Tax)
}

func (*Error) Error Uses

func (err *Error) Error() string

type ExemptRegion Uses

type ExemptRegion struct {
    Country string `json:"country,omitempty"`
    State   string `json:"state,omitempty"`
}

ExemptRegion is the structure for a customer exempt region passed within `CreateCustomerParams.ExemptRegions` and returned in `CreateCustomerResponse.Customer.ExemptRegions`․

type Jurisdictions Uses

type Jurisdictions struct {
    Country string `json:"country"`
    State   string `json:"state"`
    County  string `json:"county"`
    City    string `json:"city"`
}

Jurisdictions is the structure for `TaxForOrderResponse.Tax.Jurisdictions`․

type LineItemBreakdown Uses

type LineItemBreakdown struct {
    ID                           string  `json:"id"`
    TaxableAmount                float64 `json:"taxable_amount"`
    TaxCollectable               float64 `json:"tax_collectable"`
    CombinedTaxRate              float64 `json:"combined_tax_rate"`
    StateTaxableAmount           float64 `json:"state_taxable_amount"`
    StateSalesTaxRate            float64 `json:"state_sales_tax_rate"`
    StateAmount                  float64 `json:"state_amount"`
    CountyTaxableAmount          float64 `json:"county_taxable_amount"`
    CountyTaxRate                float64 `json:"county_tax_rate"`
    CountyAmount                 float64 `json:"county_amount"`
    CityTaxableAmount            float64 `json:"city_taxable_amount"`
    CityTaxRate                  float64 `json:"city_tax_rate"`
    CityAmount                   float64 `json:"city_amount"`
    SpecialDistrictTaxableAmount float64 `json:"special_district_taxable_amount"`
    SpecialTaxRate               float64 `json:"special_tax_rate"`
    SpecialDistrictAmount        float64 `json:"special_district_amount"`
    // Canada
    GSTTaxableAmount float64 `json:"gst_taxable_amount"`
    GSTTaxRate       float64 `json:"gst_tax_rate"`
    GST              float64 `json:"gst"`
    PSTTaxableAmount float64 `json:"pst_taxable_amount"`
    PSTTaxRate       float64 `json:"pst_tax_rate"`
    PST              float64 `json:"pst"`
    QSTTaxableAmount float64 `json:"qst_taxable_amount"`
    QSTTaxRate       float64 `json:"qst_tax_rate"`
    QST              float64 `json:"qst"`
    // Other International Attributes
    CountryTaxableAmount  float64 `json:"country_taxable_amount"`
    CountryTaxRate        float64 `json:"country_tax_rate"`
    CountryTaxCollectable float64 `json:"country_tax_collectable"`
}

LineItemBreakdown is the structure for a line item in `TaxForOrderResponse.Tax.Breakdown.LineItems`․

type ListCustomersResponse Uses

type ListCustomersResponse struct {
    Customers []string `json:"customers"`
}

ListCustomersResponse is the structure returned from `ListCustomers`․

Access the customer list with `ListCustomersResponse.Customers`․

type ListOrdersParams Uses

type ListOrdersParams struct {
    TransactionDate     string `url:"transaction_date,omitempty"`
    FromTransactionDate string `url:"from_transaction_date,omitempty"`
    ToTransactionDate   string `url:"to_transaction_date,omitempty"`
    Provider            string `url:"provider,omitempty"`
}

ListOrdersParams should be passed to `ListOrders` to list existing order IDs․

type ListOrdersResponse Uses

type ListOrdersResponse struct {
    Orders []string `json:"orders"`
}

ListOrdersResponse is the structure returned from `ListOrders`․

Access the order list with `ListOrdersResponse.Orders`․

type ListRefundsParams Uses

type ListRefundsParams struct {
    TransactionDate     string `url:"transaction_date,omitempty"`
    FromTransactionDate string `url:"from_transaction_date,omitempty"`
    ToTransactionDate   string `url:"to_transaction_date,omitempty"`
    Provider            string `url:"provider,omitempty"`
}

ListRefundsParams should be passed to `ListRefunds` to list existing refund IDs․

type ListRefundsResponse Uses

type ListRefundsResponse struct {
    Refunds []string `json:"refunds"`
}

ListRefundsResponse is the structure returned from `ListRefunds`․

Access the refund list with `ListRefundsResponse.Refunds`․

type NexusAddress Uses

type NexusAddress struct {
    ID      string `json:"id,omitempty"`
    Country string `json:"country,omitempty"`
    Zip     string `json:"zip,omitempty"`
    State   string `json:"state,omitempty"`
    City    string `json:"city,omitempty"`
    Street  string `json:"street,omitempty"`
}

NexusAddress is the structure for a nexus address passed within `TaxForOrderParams.NexusAddresses`․

type NexusRegion Uses

type NexusRegion struct {
    CountryCode string `json:"country_code"`
    Country     string `json:"country"`
    RegionCode  string `json:"region_code"`
    Region      string `json:"region"`
}

NexusRegion is the structure for a nexus region returned within `NexusRegionsResponse.Regions`․

type NexusRegionsResponse Uses

type NexusRegionsResponse struct {
    Regions []NexusRegion `json:"regions"`
}

NexusRegionsResponse is the structure returned from `NexusRegions`․

Access the nexus list with `NexusRegionsResponse.Regions`.

type Order Uses

type Order struct {
    TransactionID          string          `json:"transaction_id"`
    UserID                 int             `json:"user_id"`
    TransactionDate        string          `json:"transaction_date"`
    TransactionReferenceID string          `json:"transaction_reference_id"`
    Provider               string          `json:"provider"`
    ExemptionType          string          `json:"exemption_type,omitempty"`
    FromCountry            string          `json:"from_country"`
    FromZip                string          `json:"from_zip"`
    FromState              string          `json:"from_state"`
    FromCity               string          `json:"from_city"`
    FromStreet             string          `json:"from_street"`
    ToCountry              string          `json:"to_country"`
    ToZip                  string          `json:"to_zip"`
    ToState                string          `json:"to_state"`
    ToCity                 string          `json:"to_city"`
    ToStreet               string          `json:"to_street"`
    Amount                 float64         `json:"amount,string"`
    Shipping               float64         `json:"shipping,string"`
    SalesTax               float64         `json:"sales_tax,string"`
    LineItems              []OrderLineItem `json:"line_items"`
}

Order is the structure for an order returned within `CreateOrderResponse`, `ShowOrderResponse`, `UpdateOrderResponse`, and `DeleteOrderResponse`․

type OrderLineItem Uses

type OrderLineItem struct {
    ID                json.Number `json:"id,omitempty"`
    Quantity          int         `json:"quantity,omitempty"`
    ProductIdentifier string      `json:"product_identifier,omitempty"`
    Description       string      `json:"description,omitempty"`
    ProductTaxCode    string      `json:"product_tax_code,omitempty"`
    UnitPrice         float64     `json:"unit_price,omitempty,string"`
    Discount          float64     `json:"discount,omitempty,string"`
    SalesTax          float64     `json:"sales_tax,omitempty,string"`
}

OrderLineItem is the structure for a line item passed within `CreateOrderParams.LineItems` and `UpdateOrderParams.LineItems`․

OrderLineItem is also the structure for a line item returned within `CreateOrderResponse.Order.LineItems`, `UpdateOrderResponse.Order.LineItems`, `ShowOrderResponse.Order.LineItems`, and `DeleteOrderResponse.Order.LineItems`․

type Rate Uses

type Rate struct {
    Zip                   string  `json:"zip"`
    Country               string  `json:"country"`
    Name                  string  `json:"name"`
    StandardRate          float64 `json:"standard_rate,string"`
    ReducedRate           float64 `json:"reduced_rate,string"`
    SuperReducedRate      float64 `json:"super_reduced_rate,string"`
    ParkingRate           float64 `json:"parking_rate,string"`
    DistanceSaleThreshold float64 `json:"distance_sale_threshold,string"`
    CountryRate           float64 `json:"country_rate,string"`
    State                 string  `json:"state"`
    StateRate             float64 `json:"state_rate,string"`
    County                string  `json:"county"`
    CountyRate            float64 `json:"county_rate,string"`
    City                  string  `json:"city"`
    CityRate              float64 `json:"city_rate,string"`
    CombinedDistrictRate  float64 `json:"combined_district_rate,string"`
    CombinedRate          float64 `json:"combined_rate,string"`
    FreightTaxable        bool    `json:"freight_taxable"`
}

Rate is the structure for a given location's sales tax rates․

type RatesForLocationParams Uses

type RatesForLocationParams struct {
    Country string `url:"country,omitempty"`
    State   string `url:"state,omitempty"`
    City    string `url:"city,omitempty"`
    Street  string `url:"street,omitempty"`
}

RatesForLocationParams should be passed to `RatesForLocation` to show the sales tax rates for a given location․

type RatesForLocationResponse Uses

type RatesForLocationResponse struct {
    Rate Rate `json:"rate"`
}

RatesForLocationResponse is the structure returned from `RatesForLocation`․

Access the location's rates with `RatesForLocationResponse.Rate`․

type Refund Uses

type Refund struct {
    Order
}

Refund is the structure for a refund returned within `CreateRefundResponse`, `ShowRefundResponse`, `UpdateRefundResponse`, and `DeleteRefundResponse`․

type RefundLineItem Uses

type RefundLineItem struct {
    ID                string  `json:"id,omitempty"`
    Quantity          int     `json:"quantity,omitempty"`
    ProductIdentifier string  `json:"product_identifier,omitempty"`
    Description       string  `json:"description,omitempty"`
    ProductTaxCode    string  `json:"product_tax_code,omitempty"`
    UnitPrice         float64 `json:"unit_price,omitempty"`
    Discount          float64 `json:"discount,omitempty"`
    SalesTax          float64 `json:"sales_tax,omitempty"`
}

RefundLineItem is the structure for a line item passed within `CreateRefundParams.LineItems` and `UpdateRefundParams.LineItems`․

RefundLineItem is also the structure for a line item returned within `CreateRefundResponse.Refund.LineItems`, `UpdateRefundResponse.Refund.LineItems`, `ShowRefundResponse.Refund.LineItems`, and `DeleteRefundResponse.Refund.LineItems`․

type Shipping Uses

type Shipping struct {
    TaxableAmount         float64 `json:"taxable_amount"`
    TaxCollectable        float64 `json:"tax_collectable"`
    CombinedTaxRate       float64 `json:"combined_tax_rate"`
    StateTaxableAmount    float64 `json:"state_taxable_amount"`
    StateSalesTaxRate     float64 `json:"state_sales_tax_rate"`
    StateAmount           float64 `json:"state_amount"`
    CountyTaxableAmount   float64 `json:"county_taxable_amount"`
    CountyTaxRate         float64 `json:"county_tax_rate"`
    CountyAmount          float64 `json:"county_amount"`
    CityTaxableAmount     float64 `json:"city_taxable_amount"`
    CityTaxRate           float64 `json:"city_tax_rate"`
    CityAmount            float64 `json:"city_amount"`
    SpecialTaxableAmount  float64 `json:"special_taxable_amount"`
    SpecialTaxRate        float64 `json:"special_tax_rate"`
    SpecialDistrictAmount float64 `json:"special_district_amount"`
    // Canada
    GSTTaxableAmount float64 `json:"gst_taxable_amount"`
    GSTTaxRate       float64 `json:"gst_tax_rate"`
    GST              float64 `json:"gst"`
    PSTTaxableAmount float64 `json:"pst_taxable_amount"`
    PSTTaxRate       float64 `json:"pst_tax_rate"`
    PST              float64 `json:"pst"`
    QSTTaxableAmount float64 `json:"qst_taxable_amount"`
    QSTTaxRate       float64 `json:"qst_tax_rate"`
    QST              float64 `json:"qst"`
    // Other International Attributes
    CountryTaxableAmount  float64 `json:"country_taxable_amount"`
    CountryTaxRate        float64 `json:"country_tax_rate"`
    CountryTaxCollectable float64 `json:"country_tax_collectable"`
}

Shipping is the structure for `TaxForOrderResponse.Tax.Breakdown.Shipping`․

type ShowCustomerResponse Uses

type ShowCustomerResponse struct {
    CreateCustomerResponse
}

ShowCustomerResponse is the structure returned from `ShowCustomer`․

Access the customer with `ShowCustomerResponse.Customer`․

type ShowOrderParams Uses

type ShowOrderParams struct {
    Provider string `url:"provider,omitempty"`
}

ShowOrderParams should be passed to `ShowOrder` to show an order․

type ShowOrderResponse Uses

type ShowOrderResponse struct {
    Order Order `json:"order"`
}

ShowOrderResponse is the structure returned from `ShowOrder`․

Access the order with `ShowOrderResponse.Order`․

type ShowRefundParams Uses

type ShowRefundParams struct {
    Provider string `url:"provider,omitempty"`
}

ShowRefundParams should be passed to `ShowRefund` to show a refund․

type ShowRefundResponse Uses

type ShowRefundResponse struct {
    Refund Refund `json:"refund"`
}

ShowRefundResponse is the structure returned from `ShowRefund`․

Access the refund with `ShowRefundResponse.Refund`․

type SummaryRate Uses

type SummaryRate struct {
    CountryCode string `json:"country_code"`
    Country     string `json:"country"`
    RegionCode  string `json:"region_code"`
    Region      string `json:"region"`
    MinimumRate struct {
        Label string  `json:"label"`
        Rate  float64 `json:"rate"`
    }   `json:"minimum_rate"`
    AverageRate struct {
        Label string  `json:"label"`
        Rate  float64 `json:"rate"`
    }   `json:"average_rate"`
}

SummaryRate is the structure for a location's summarized (minimum and average) backup rates returned within `SummaryRatesResponse.SummaryRates`․

type SummaryRatesResponse Uses

type SummaryRatesResponse struct {
    SummaryRates []SummaryRate `json:"summary_rates"`
}

SummaryRatesResponse is the structure returned from `SummaryRates`․

Access the summarized (minimum and average) backup rates with `SummaryRatesResponse.SummaryRates`.

type Tax Uses

type Tax struct {
    OrderTotalAmount float64       `json:"order_total_amount"`
    Shipping         float64       `json:"shipping"`
    TaxableAmount    float64       `json:"taxable_amount"`
    AmountToCollect  float64       `json:"amount_to_collect"`
    Rate             float64       `json:"rate"`
    HasNexus         bool          `json:"has_nexus"`
    FreightTaxable   bool          `json:"freight_taxable"`
    TaxSource        string        `json:"tax_source"`
    ExemptionType    string        `json:"exemption_type"`
    Jurisdictions    Jurisdictions `json:"jurisdictions"`
    Breakdown        Breakdown     `json:"breakdown"`
}

Tax is the stucture for a tax calculation returned within `TaxForOrderResponse`․

type TaxForOrderParams Uses

type TaxForOrderParams struct {
    FromCountry    string         `json:"from_country,omitempty"`
    FromZip        string         `json:"from_zip,omitempty"`
    FromState      string         `json:"from_state,omitempty"`
    FromCity       string         `json:"from_city,omitempty"`
    FromStreet     string         `json:"from_street,omitempty"`
    ToCountry      string         `json:"to_country,omitempty"`
    ToZip          string         `json:"to_zip,omitempty"`
    ToState        string         `json:"to_state,omitempty"`
    ToCity         string         `json:"to_city,omitempty"`
    ToStreet       string         `json:"to_street,omitempty"`
    Amount         float64        `json:"amount,omitempty"`
    Shipping       float64        `json:"shipping"`
    CustomerID     string         `json:"customer_id,omitempty"`
    ExemptionType  string         `json:"exemption_type,omitempty"`
    NexusAddresses []NexusAddress `json:"nexus_addresses,omitempty"`
    LineItems      []TaxLineItem  `json:"line_items,omitempty"`
}

TaxForOrderParams should be passed to `TaxForOrder` to calculate tax․

type TaxForOrderResponse Uses

type TaxForOrderResponse struct {
    Tax Tax `json:"tax"`
}

TaxForOrderResponse is the structure returned from `TaxForOrder`․

Access the calculated tax with `TaxForOrderResponse.Tax`․

type TaxLineItem Uses

type TaxLineItem struct {
    ID             string  `json:"id,omitempty"`
    Quantity       int     `json:"quantity,omitempty"`
    ProductTaxCode string  `json:"product_tax_code,omitempty"`
    UnitPrice      float64 `json:"unit_price,omitempty"`
    Discount       float64 `json:"discount,omitempty"`
}

TaxLineItem is the structure for a line item passed within `TaxForOrderParams.LineItems`․

type UpdateCustomerParams Uses

type UpdateCustomerParams struct {
    CustomerID    string         `json:"customer_id,omitempty"`
    ExemptionType string         `json:"exemption_type,omitempty"`
    Name          string         `json:"name,omitempty"`
    ExemptRegions []ExemptRegion `json:"exempt_regions,omitempty"`
    Country       string         `json:"country,omitempty"`
    State         string         `json:"state,omitempty"`
    Zip           string         `json:"zip,omitempty"`
    City          string         `json:"city,omitempty"`
    Street        string         `json:"street,omitempty"`
}

UpdateCustomerParams should be passed to `UpdateCustomer` to update an existing customer․

type UpdateCustomerResponse Uses

type UpdateCustomerResponse struct {
    CreateCustomerResponse
}

UpdateCustomerResponse is the structure returned from `UpdateCustomer`․

Access the updated customer with `UpdateCustomerResponse.Customer`.

type UpdateOrderParams Uses

type UpdateOrderParams struct {
    TransactionID   string          `json:"transaction_id,omitempty"`
    TransactionDate string          `json:"transaction_date,omitempty"`
    FromCountry     string          `json:"from_country,omitempty"`
    FromZip         string          `json:"from_zip,omitempty"`
    FromState       string          `json:"from_state,omitempty"`
    FromCity        string          `json:"from_city,omitempty"`
    FromStreet      string          `json:"from_street,omitempty"`
    ToCountry       string          `json:"to_country,omitempty"`
    ToZip           string          `json:"to_zip,omitempty"`
    ToState         string          `json:"to_state,omitempty"`
    ToCity          string          `json:"to_city,omitempty"`
    ToStreet        string          `json:"to_street,omitempty"`
    Amount          float64         `json:"amount,omitempty"`
    Shipping        float64         `json:"shipping,omitempty"`
    SalesTax        float64         `json:"sales_tax,omitempty"`
    CustomerID      string          `json:"customer_id,omitempty"`
    ExemptionType   string          `json:"exemption_type,omitempty"`
    LineItems       []OrderLineItem `json:"line_items,omitempty"`
}

UpdateOrderParams should be passed to `UpdateOrder` to update an existing order․

type UpdateOrderResponse Uses

type UpdateOrderResponse struct {
    Order Order `json:"order"`
}

UpdateOrderResponse is the structure returned from `UpdateOrder`․

Access the updated order with `UpdateOrderResponse.Order`․

type UpdateRefundParams Uses

type UpdateRefundParams struct {
    TransactionID          string           `json:"transaction_id,omitempty"`
    TransactionReferenceID string           `json:"transaction_reference_id,omitempty"`
    TransactionDate        string           `json:"transaction_date,omitempty"`
    FromCountry            string           `json:"from_country,omitempty"`
    FromZip                string           `json:"from_zip,omitempty"`
    FromState              string           `json:"from_state,omitempty"`
    FromCity               string           `json:"from_city,omitempty"`
    FromStreet             string           `json:"from_street,omitempty"`
    ToCountry              string           `json:"to_country,omitempty"`
    ToZip                  string           `json:"to_zip,omitempty"`
    ToState                string           `json:"to_state,omitempty"`
    ToCity                 string           `json:"to_city,omitempty"`
    ToStreet               string           `json:"to_street,omitempty"`
    Amount                 float64          `json:"amount,omitempty"`
    Shipping               float64          `json:"shipping,omitempty"`
    SalesTax               float64          `json:"sales_tax,omitempty"`
    CustomerID             string           `json:"customer_id,omitempty"`
    ExemptionType          string           `json:"exemption_type,omitempty"`
    LineItems              []RefundLineItem `json:"line_items,omitempty"`
}

UpdateRefundParams should be passed to `UpdateRefund` to update an existing refund․

type UpdateRefundResponse Uses

type UpdateRefundResponse struct {
    Refund Refund `json:"refund"`
}

UpdateRefundResponse is the structure returned from `UpdateRefund`․

Access the updated refund with `UpdateRefundResponse.Refund`․

type VIESResponse Uses

type VIESResponse struct {
    CountryCode string `json:"country_code"`
    VATNumber   string `json:"vat_number"`
    RequestDate string `json:"request_date"`
    Valid       bool   `json:"valid"`
    Name        string `json:"name"`
    Address     string `json:"address"`
}

VIESResponse is the structure for a response from VIES (http://ec.europa.eu/taxation_customs/vies/) returned as `ValidateResponse.Validation.ViesResponse`․

type ValidateAddressParams Uses

type ValidateAddressParams struct {
    Country string `json:"country,omitempty"`
    State   string `json:"state,omitempty"`
    Zip     string `json:"zip,omitempty"`
    City    string `json:"city,omitempty"`
    Street  string `json:"street,omitempty"`
}

ValidateAddressParams should be passed to `ValidateAddress` to validate an address․

type ValidateAddressResponse Uses

type ValidateAddressResponse struct {
    Addresses []Address `json:"addresses"`
}

ValidateAddressResponse is the structure returned from `ValidateAddress․`

Access the returned list of address matches with `ValidateAddressResponse.Addresses`․

type ValidateParams Uses

type ValidateParams struct {
    VAT string `url:"vat,omitempty"`
}

ValidateParams should be passed to `Validate` to validate a VAT identification number with VIES (http://ec.europa.eu/taxation_customs/vies/)․

type ValidateResponse Uses

type ValidateResponse struct {
    Validation Validation `json:"validation"`
}

ValidateResponse is the structure returned from `Validate`․

Access the validation with `ValidateResponse.Validation`․

type Validation Uses

type Validation struct {
    Valid         bool         `json:"valid"`
    Exists        bool         `json:"exists"`
    VIESAvailable bool         `json:"vies_available"`
    VIESResponse  VIESResponse `json:"vies_response"`
}

Validation is the structure for a VAT identification number validation returned within `ValidateResponse`․

Directories

PathSynopsis
example
test/mocks

Package taxjar imports 13 packages (graph) and is imported by 2 packages. Updated 2020-06-17. Refresh now. Tools for package owners.