Umbraco Commerce
CMSCloudHeartcoreDXP
15.latest
15.latest
  • Umbraco Commerce Documentation
  • Release Notes
    • v15.1.0-Rc
    • v15.0.0-Rc
  • Commerce Products
    • Commerce Packages
    • Commerce Payment Providers
    • Commerce Shipping Providers
  • Getting Started
    • Requirements
    • Installation
    • Licensing
    • Configuration
    • User Interface
  • Upgrading
    • Upgrading Umbraco Commerce
    • Version Specific Upgrade Notes
    • Migrate from Vendr to Umbraco Commerce
      • Migrate Umbraco Commerce Checkout
      • Migrate custom Payment Providers
  • Tutorials
    • Build a Store in Umbraco using Umbraco Commerce
      • Installation
      • Creating a Store
        • Configuring your Store
      • Creating your first Product
      • Implementing a Shopping Cart
        • Using the Umbraco.Commerce.Cart Drop-in Shopping Cart
        • Creating a Custom Shopping Cart
      • Implementing a Checkout Flow
        • Using the Umbraco.Commerce.Checkout Drop-in Checkout Flow
        • Creating a Custom Checkout Flow
      • Configuring Store Access Permissions
  • How-To Guides
    • Overview
    • Configure SQLite support
    • Use an Alternative Database for Umbraco Commerce Tables
    • Customizing Templates
    • Configuring Cart Cleanup
    • Limit Order Line Quantity
    • Implementing Product Bundles
    • Implementing Member Based Pricing
    • Implementing Dynamically Priced Products
    • Implementing Personalized Products
    • Implementing a Currency Switcher
    • Building a Members Portal
    • Order Number Customization
    • Create an Order via Code
  • Key Concepts
    • Get to know the main features
    • Base Currency
    • Calculators
    • Currency Exchange Rate Service Provider
    • Dependency Injection
    • Discount Rules / Rewards
    • Events
      • List of validation events
      • List of notification events
    • Fluent API
    • Order Calculation State
    • Payment Forms
    • Payment Providers
    • Pipelines
    • Price/Amount Adjustments
    • Price Freezing
    • Product Adapters
    • Product Bundles
    • Product Variants
      • Complex Variants
    • Properties
    • ReadOnly and Writable Entities
    • Sales Tax Providers
    • Search Specifications
    • Settings Objects
    • Shipping Package Factories
    • Shipping Providers
    • Shipping Range/Rate Providers
    • Tax Sources
    • UI Extensions
      • Analytics Widgets
      • Entity Quick Actions
      • Order Line Actions
      • Order Properties
      • Order Collection Properties
      • Order Line Properties
      • Store Menu Items
    • Umbraco Properties
    • Unit of Work
    • Umbraco Commerce Builder
    • Webhooks
  • Reference
    • Stores
    • Shipping
      • Fixed Rate Shipping
      • Dynamic Rate Shipping
      • Realtime Rate Shipping
    • Payments
      • Configure Refunds
      • Issue Refunds
    • Taxes
      • Fixed Tax Rates
      • Calculated Tax Rates
    • Storefront API
      • Endpoints
        • Order
        • Checkout
        • Product
        • Customer
        • Store
        • Currency
        • Country
        • Payment method
        • Shipping method
        • Content
    • Management API
    • Go behind the scenes
    • Telemetry
Powered by GitBook
On this page
  • Example Sales Tax Provider
  • Sales Tax Provider Responsibilities
  • Realtime Rates
  • Localization

Was this helpful?

Edit on GitHub
Export as PDF
  1. Key Concepts

Sales Tax Providers

Realtime sales tax features via Sales Tax Providers in Umbraco Commerce.

Sales Tax Providers are how Umbraco Commerce can perform real-time sales tax operations. Their job is to provide a standard interface between third-party sales tax operators and Umbraco Commerce. This is done to allow the passing of information between the two platforms.

How the integrations work is often different for each sales tax operator. The Umbraco Commerce Sales Tax Providers add a flexible interface that should work with most sales tax operators.

Example Sales Tax Provider

An example of a bare-bones Sales Tax Provider would look something like this:

[SalesTaxProvider("my-sales-tax-provider-alias")]
public class MySalesTaxProvider :  SalesTaxProviderBase<MySalesTaxProviderSettings>
{
    public MySalesTaxProvider(UmbracoCommerceContext umbracoCommerce)
        : base(umbracoCommerce)
    { }

    ...
}

public class MySalesTaxProviderSettings
{
    [SalesTaxProviderSetting]
    public string ApiKey { get; set; }

    ...
}

All Sales Tax Providers inherit from a base class SalesTaxProviderBase<TSettings>. TSettings is the type of a Plain Old Class Object (POCO) model class representing the Sales Tax Providers settings. The class must be decorated with SalesTaxProviderAttribute which defines the Sales Tax Providers alias.

The settings class consists of a series of properties, each decorated with a SalesTaxProviderSettingAttribute. These will all be used to dynamically build an editor interface for the given settings in the backoffice.

Sales Tax Provider Responsibilities

The responsibilities of a Sales Tax Provider are:

  • Realtime Rates - Calculating sales tax rate options for a given Order.

Realtime Rates

Real-time rates are returned by implementing the CalculateSalesTaxAsync method. To facilitate rate calculation, a SalesTaxProviderContext object is passed to this method providing useful, contextual information, including:

  • Order - The Order and its items to be shipped.

  • OrderCalculation - The current order calculation state.

  • FromAddress - The address from which shipments will be shipped from.

  • ToAddress - The address to which shipments will be shipped to.

  • Settings - The sales tax provider settings are captured via the backoffice UI.

  • AdditionalData - A general dictionary store for any data that may need passing between methods.

  • HttpContext - A reference to the current HTTP context.

Implementors should use these details to pass to the 3rd party sales tax operators API and retrieve the sales tax costs. These should then be returned to Umbraco Commerce as a SalesTaxCalculationResult which contains an Amount property for the total sales tax amount.

Localization

Umbraco Commerce will automatically look for the following entries:

Key
Description

ucSalesTaxProviders_{providerAlias}Label

A main label for the provider

ucSalesTaxProviders_{providerAlias}Description

A description for the provider

ucSalesTaxProviders_{providerAlias}Settings{settingAlias}Label

A label for a provider setting

ucSalesTaxProviders_{providerAlias}Settings{settingAlias}Description

A description for a provider setting

Here {providerAlias} is the alias of the provider and {settingAlias} is the alias of a setting.

PreviousReadOnly and Writable EntitiesNextSearch Specifications

Last updated 5 months ago

Was this helpful?

Labels and descriptions for providers and their settings are controlled through entries.

When displaying your provider in the backoffice UI, it is neceserray to provide localizable labels. This is controlled by Umbraco's feature.

UI Localization
Localization