(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"
"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.Create(ctx, operations.AccountingTaxRatesAddRequest{
ServiceID: sdkgo.String("salesforce"),
TaxRate: 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),
},
},
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.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",
},
},
},
},
},
},
CustomFields: []components.CustomField{
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueArrayOfStr(
[]string{
"<value>",
"<value>",
"<value>",
},
)),
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.CreateTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingTaxRatesAddRequest | ✔️ | The request object to use for the request. |
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"
"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.Get(ctx, operations.AccountingTaxRatesOneRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingTaxRatesOneRequest | ✔️ | The request object to use for the request. |
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"
"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.Update(ctx, operations.AccountingTaxRatesUpdateRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
TaxRate: 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.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",
},
},
},
},
},
},
CustomFields: []components.CustomField{
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueBoolean(
true,
)),
},
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueFour(
components.Four{},
)),
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.UpdateTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingTaxRatesUpdateRequest | ✔️ | The request object to use for the request. |
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"
"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.Delete(ctx, operations.AccountingTaxRatesDeleteRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
})
if err != nil {
log.Fatal(err)
}
if res.DeleteTaxRateResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingTaxRatesDeleteRequest | ✔️ | The request object to use for the request. |
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 | */* |