(Accounting.TaxRates)
- List - List Tax Rates
- Create - Create Tax Rate
- Get - Get Tax Rate
- Update - Update Tax Rate
- Delete - Delete Tax Rate
List Tax Rates. Note: Not all connectors return the actual rate/percentage value. In this case, only the tax code or reference is returned. Connectors Affected: Quickbooks
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.TaxRates.List(ctx, operations.AccountingTaxRatesAllRequest{
ServiceID: sdkgo.String("salesforce"),
Filter: &components.TaxRatesFilter{
Assets: sdkgo.Bool(true),
Equity: sdkgo.Bool(true),
Expenses: sdkgo.Bool(true),
Liabilities: sdkgo.Bool(true),
Revenue: sdkgo.Bool(true),
},
PassThrough: map[string]any{
"search": "San Francisco",
},
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetTaxRatesResponse != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingTaxRatesAllRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingTaxRatesAllResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Create Tax Rate
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.TaxRates.Create(ctx, components.TaxRateInput{
ID: sdkgo.String("1234"),
Name: sdkgo.String("GST on Purchases"),
Code: sdkgo.String("ABN"),
Description: sdkgo.String("Reduced rate GST Purchases"),
EffectiveTaxRate: sdkgo.Float64(10),
TotalTaxRate: sdkgo.Float64(10),
TaxPayableAccountID: sdkgo.String("123456"),
TaxRemittedAccountID: sdkgo.String("123456"),
Components: []components.Components{
components.Components{
ID: sdkgo.String("10"),
Name: sdkgo.String("GST"),
Rate: sdkgo.Float64(10),
Compound: sdkgo.Bool(true),
},
},
Type: sdkgo.String("NONE"),
ReportTaxType: sdkgo.String("NONE"),
OriginalTaxRateID: sdkgo.String("12345"),
Status: components.TaxRateStatusActive.ToPointer(),
RowVersion: sdkgo.String("1-12345"),
PassThrough: []components.PassThroughBody{
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
},
}, nil, sdkgo.String("salesforce"))
if err != nil {
log.Fatal(err)
}
if res.CreateTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
taxRate |
components.TaxRateInput | ✔️ | N/A | |
raw |
*bool | ➖ | Include raw response. Mostly used for debugging purposes | |
serviceID |
*string | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingTaxRatesAddResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get Tax Rate. Note: Not all connectors return the actual rate/percentage value. In this case, only the tax code or reference is returned. Support will soon be added to return the actual rate/percentage by doing additional calls in the background to provide the full view of a given tax rate. Connectors Affected: Quickbooks
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.TaxRates.Get(ctx, "<id>", sdkgo.String("salesforce"), nil, sdkgo.String("id,updated_at"))
if err != nil {
log.Fatal(err)
}
if res.GetTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
id |
string | ✔️ | ID of the record you are acting upon. | |
serviceID |
*string | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
*bool | ➖ | Include raw response. Mostly used for debugging purposes | |
fields |
*string | ➖ | The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. Example: fields=name,email,addresses.city In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded. |
id,updated_at |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingTaxRatesOneResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update Tax Rate
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.TaxRates.Update(ctx, "<id>", components.TaxRateInput{
ID: sdkgo.String("1234"),
Name: sdkgo.String("GST on Purchases"),
Code: sdkgo.String("ABN"),
Description: sdkgo.String("Reduced rate GST Purchases"),
EffectiveTaxRate: sdkgo.Float64(10),
TotalTaxRate: sdkgo.Float64(10),
TaxPayableAccountID: sdkgo.String("123456"),
TaxRemittedAccountID: sdkgo.String("123456"),
Components: []components.Components{
components.Components{
ID: sdkgo.String("10"),
Name: sdkgo.String("GST"),
Rate: sdkgo.Float64(10),
Compound: sdkgo.Bool(true),
},
components.Components{
ID: sdkgo.String("10"),
Name: sdkgo.String("GST"),
Rate: sdkgo.Float64(10),
Compound: sdkgo.Bool(true),
},
components.Components{
ID: sdkgo.String("10"),
Name: sdkgo.String("GST"),
Rate: sdkgo.Float64(10),
Compound: sdkgo.Bool(true),
},
},
Type: sdkgo.String("NONE"),
ReportTaxType: sdkgo.String("NONE"),
OriginalTaxRateID: sdkgo.String("12345"),
Status: components.TaxRateStatusActive.ToPointer(),
RowVersion: sdkgo.String("1-12345"),
PassThrough: []components.PassThroughBody{
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
},
}, sdkgo.String("salesforce"), nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
id |
string | ✔️ | ID of the record you are acting upon. | |
taxRate |
components.TaxRateInput | ✔️ | N/A | |
serviceID |
*string | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
*bool | ➖ | Include raw response. Mostly used for debugging purposes | |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingTaxRatesUpdateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Delete Tax Rate
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.TaxRates.Delete(ctx, "<id>", sdkgo.String("salesforce"), nil)
if err != nil {
log.Fatal(err)
}
if res.DeleteTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
id |
string | ✔️ | ID of the record you are acting upon. | |
serviceID |
*string | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
*bool | ➖ | Include raw response. Mostly used for debugging purposes | |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingTaxRatesDeleteResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |