> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CalculateAdditionalFees

# Package: additionalFees

# Namespace: AdditionalFeesSPI

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/additional-fees/additional-fees-service-plugin/calculate-additional-fees.md

## Introduction

Requests calculation of additional fees from the service plugin implementer for a given cart or checkout.

Wix calls this method when a site visitor views their cart, begins checkout, or when cart contents change during the checkout process.

Wix uses the returned additional fees to display line items on the cart and checkout pages and to calculate the final order total.

Your implementation must respond within 3 seconds. Longer response times result in timeout errors.

**Restrictions:** Do not call the Estimate Cart Totals, Estimate Current Cart Totals, or Get Checkout methods from your implementation. Doing so results in a runtime error.

**Error handling:** If your implementation returns an error or times out, Wix proceeds without additional fees. The site visitor won't see additional fees on their cart or checkout.

---

## REST API

### Schema

```
 Method: calculateAdditionalFees
 Description: Requests calculation of additional fees from the service plugin implementer for a given cart or checkout.  Wix calls this method when a site visitor views their cart, begins checkout, or when cart contents change during the checkout process.  Wix uses the returned additional fees to display line items on the cart and checkout pages and to calculate the final order total.  Your implementation must respond within 3 seconds. Longer response times result in timeout errors.  **Restrictions:** Do not call the Estimate Cart Totals, Estimate Current Cart Totals, or Get Checkout methods from your implementation. Doing so results in a runtime error.  **Error handling:** If your implementation returns an error or times out, Wix proceeds without additional fees. The site visitor won't see additional fees on their cart or checkout.
 URL: {DEPLOYMENT-URI}/v1/calculate-additional-fees
 Method: POST
 Method parameters:
   param name: appliedDiscounts | type: array<appliedDiscounts> | description: Discounts applied to the cart or checkout. Includes coupons, merchant discounts, and discount rules.  | validation: maxItems 320
              - ONE-OF: 
                 - name: coupon | type: Coupon | description: Coupon code applied by the site visitor.  
                    - name: id | type: string | description: Coupon GUID.  
                    - name: code | type: string | description: Coupon code entered by the site visitor. For example, "SUMMER20" or "WELCOME10".  
                    - name: name | type: string | description: Display name of the coupon. Shown to the site visitor on the cart and checkout pages.  
                    - name: amount | type: string | description: Discount amount provided by the coupon. Can represent a fixed amount or a calculated percentage discount value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
                 - name: merchantDiscount | type: MerchantDiscount | description: Manual discount applied by the merchant during checkout or order processing.  
                    - name: amount | type: string | description: Discount amount applied by the merchant.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
                 - name: discountRule | type: DiscountRule | description: Automatic discount rule configured by the merchant.  
                    - name: id | type: string | description: Discount rule GUID.  | validation: format GUID
                    - name: name | type: DiscountRuleName | description: Name of the discount rule in original and translated forms.  
                       - name: original | type: string | description: Original name of the discount rule as configured by the merchant.  | validation: minLength 1, maxLength 256
                       - name: translated | type: string | description: Translated name of the discount rule. When provided, this value is displayed to the site visitor instead of `original`.  | validation: minLength 1, maxLength 500
                    - name: amount | type: string | description: Discount amount applied by the rule. Can represent a fixed amount or a calculated percentage discount value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
              - name: discountType | type: DiscountType | description: Type of this discount.  
                     - enum:
                     -     GLOBAL: Discount applies to the entire order.
                     -     SPECIFIC_ITEMS: Discount applies only to specific items in the cart.
                     -     SHIPPING: Discount applies to shipping costs.
              - name: lineItemIds | type: array<string> | description: IDs of line items this discount applies to.  Available only when `discountType` is `SPECIFIC_ITEMS`.  | validation: format GUID
   param name: businessLocationId | type: businessLocationId | description: GUID of the business location fulfilling the order. Learn more about the [Locations API](https://dev.wix.com/docs/rest/business-management/locations/introduction.md).  | validation: format GUID
   param name: buyerDetails | type: BuyerDetails | description: Information about the buyer making the purchase.  
        - name: contactDetails | type: FullAddressContactDetails | description: Contact information for the buyer, including name, email, phone number, and address.  
           - name: firstName | type: string | description: Contact's first name.  
           - name: lastName | type: string | description: Contact's last name.  
           - name: phone | type: string | description: Contact's phone number.  | validation: format PHONE
           - name: company | type: string | description: Contact's company name.  
           - name: email | type: string | description: Email associated with the address.  | validation: format EMAIL
           - name: vatId | type: VatId | description: Tax info. Currently usable only in Brazil.  
              - name: id | type: string | description: Customer's tax GUID.  
              - name: type | type: VatType | description: Tax type.  Supported values: + `CPF`: for individual tax payers + `CNPJ`: for corporations  
                     - enum:
                     -     UNSPECIFIED: 
                     -     CPF: CPF - for individual tax payers.
                     -     CNPJ: CNPJ - for corporations
   param name: extendedFields | type: ExtendedFields    
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
   param name: lineItems | type: array<lineItems> | description: Line items in the cart or checkout. Each line item represents a product with quantity and pricing information.  | validation: maxItems 300
              - name: id | type: string | description: Line item GUID.  | validation: minLength 1, maxLength 100
              - name: quantity | type: integer | description: Number of this item in the cart or checkout.  | validation: minimum 0, maximum 100000, format int32
              - name: catalogReference | type: CatalogReference | description: Reference to the product in the catalog. Contains the catalog app GUID and product information.  
                 - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to.  | validation: minLength 1, maxLength 36
                 - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
                 - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  
              - name: productName | type: string | description: Name of the product. Displayed to the site visitor on cart and checkout pages.  | validation: minLength 0, maxLength 200
              - name: price | type: string | description: Price per unit of the product.  | validation: decimalValue {"gte":"0"}
              - name: physicalProperties | type: PhysicalProperties | description: Physical properties of the product, such as weight and dimensions. Used for calculating shipping costs and fees that depend on product characteristics.  
                 - name: weight | type: number | description: Line item weight. Measurement unit matches the weight unit specified in `weightUnit` in the request.  | validation: format double
                 - name: sku | type: string | description: Stock-keeping unit. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).  | validation: maxLength 40
                 - name: shippable | type: boolean | description: Whether this line item is shippable.  
                 - name: productDimensions | type: Dimensions | description: Product dimensions (length, width, height of the physical product).  
                    - name: length | type: string | description: Length. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                    - name: width | type: string | description: Width. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                    - name: height | type: string | description: Height. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                    - name: unit | type: DimensionsUnit | description: Unit of measurement for dimensions (length, width, height).  
                             - enum:
                             -     UNKNOWN_DIMENSIONS_UNIT: 
                             -     MM: Millimeters.
                             -     CM: Centimeters.
                             -     M: Meters.
                             -     IN: Inches.
                             -     FT: Feet.
                             -     YD: Yards.
                 - name: packageDimensions | type: Dimensions | description: Package dimensions (length, width, height of the shipping package).  
              - name: depositAmount | type: string | description: Deposit amount required for this line item. For example, a bottle deposit for beverages.  | validation: format DECIMAL_VALUE
              - name: modifierGroups | type: array<ModifierGroup> | description: Product options selected for this line item. For example, size, color, or custom engraving. Each modifier group represents a type of option, such as "Size" with values like "Small", "Medium", "Large".  | validation: maxItems 25
                 - name: id | type: string | description: Modifier group GUID.  | validation: minLength 1, maxLength 36
                 - name: name | type: TranslatableString | description: Modifier group name.  
                    - name: original | type: string | description: __Required.__ String in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions.md#request-envelope).  Min: 1 character. Max: 200 characters.  | validation: minLength 1, maxLength 200
                    - name: translated | type: string | description: String translated into the buyer's language.  Min: 1 character. Max: 400 characters. Default: Same as `original`.  | validation: minLength 1, maxLength 400
                 - name: modifiers | type: array<ItemModifier> | description: List of modifiers in this group.  | validation: minItems 1, maxItems 25
                    - name: id | type: string | description: Modifier GUID.  | validation: minLength 1, maxLength 36
                    - name: quantity | type: integer | description: The quantity of this modifier.  | validation: minimum 1, maximum 100000, format int32
                    - name: label | type: TranslatableString | description: Primary display label for the modifier.  
                    - name: details | type: TranslatableString | description: Additional details.  
                    - name: price | type: string | description: The price of the modifier.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":3}
   param name: purchaseFlowId | type: purchaseFlowId | description: Persistent GUID that correlates between the various eCommerce elements: cart, checkout, and order. Use this to tie additional-fee calculations to a specific purchase flow across the cart, checkout, and resulting order.  | validation: format GUID
   param name: shippingAddress | type: Address | description: Physical address  
        - name: country | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format.  | validation: format COUNTRY
        - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format.  | validation: maxLength 50
        - name: city | type: string | description: City name.  | validation: maxLength 50
        - name: postalCode | type: string | description: Postal or zip code.  | validation: maxLength 50
        - name: streetAddress | type: StreetAddress | description: Street address.  
           - name: number | type: string | description: Street number.  
           - name: name | type: string | description: Street name.  
        - name: addressLine | type: string | description: Main address line (usually street name and number).  | validation: maxLength 150
        - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apt, suite, floor.  | validation: maxLength 100
        - name: geocode | type: AddressLocation | description: Geocode object containing latitude and longitude coordinates.  
           - name: latitude | type: number | description: Address latitude.  | validation: format double
           - name: longitude | type: number | description: Address longitude.  | validation: format double
   param name: shippingInfo | type: ShippingInformation | description: Information about shipping for the order.  
        - name: selectedCarrierServiceOption | type: SelectedCarrierServiceOption | description: Shipping method and carrier selected by the site visitor.  
           - name: code | type: string | description: Unique code identifying the carrier service. For example, "usps-priority" or "fedex-ground".  | validation: maxLength 100
           - name: otherCharges | type: array<SelectedCarrierServiceOptionOtherCharge> | description: Additional charges associated with the shipping method, such as handling fees or insurance.  | validation: maxItems 100
              - name: type | type: ChargeType | description: Type of charge.  
                     - enum:
                     -     HANDLING_FEE: Handling fee charged for processing the shipment.
                     -     INSURANCE: Insurance fee to protect the shipment during transit.
              - name: details | type: string | description: Additional details about the charge. For example, "Signature required" for insurance.  | validation: maxLength 200
              - name: cost | type: SelectedCarrierServiceOptionPrices | description: Cost of the additional charge.  
                 - name: price | type: string | description: Base price of the shipping method before discounts.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
                 - name: totalDiscount | type: string | description: Total discount amount applied to the shipping cost.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
   param name: sitePaymentMethodTypeId | type: sitePaymentMethodTypeId | description: GUID of the site payment method type the customer selected to pay with. Learn more about the [Site Payment Method Types API](https://dev.wix.com/docs/api-reference/business-management/payments/site-payment-method-types/introduction.md).  Available only when the customer selects a payment method during the purchase flow.  | validation: format GUID
   param name: subtotal | type: subtotal | description: Subtotal of all line items before additional fees, shipping, and tax. Calculated as the sum of `lineItems[i].price * lineItems[i].quantity` across all line items. Whether already-applied discounts are reflected in this value depends on `itemDiscountsAppliedToPrices` and the cart's discount-application mode.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":3}
 Return type: CalculateAdditionalFeesResponse
  - name: additionalFees | type: array<AdditionalFee> | description: Additional fees calculated for the cart or checkout. Each fee represents a separate line item that will be added to the order total.  | validation: maxItems 100
     - name: code | type: string | description: Unique code identifying the type of fee. For example, `fragile-packaging` or `gift-wrap`. Used for internal tracking and reporting.  | validation: minLength 1, maxLength 100
     - name: name | type: string | description: Display name of the fee shown to the site visitor on the cart and checkout pages. For example, "Fragile Packaging Fee" or "Gift Wrapping".  | validation: minLength 1, maxLength 50
     - name: price | type: string | description: Price of the fee, excluding any tax. This amount is added to the order total.  If `taxDetails.taxable` is `true`, Wix calculates tax on top of this price — do not include tax in this value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
     - name: taxDetails | type: TaxDetails | description: Tax information for the fee. Determines whether the fee is taxable and which tax rules apply.  
        - name: taxable | type: boolean | description: Whether the fee is subject to tax. When `true`, Wix applies the site's tax rules to calculate tax on the fee amount.  Default: `false`  
        - name: taxGroupId | type: string | description: GUID of the tax group that defines tax rates and rules for this fee.  Wix treats an GUID that doesn't match a tax group on the site as if you didn't set `taxGroupId`.  A fee in the `Additional fees` default tax group isn't taxed until a Wix user configures tax for that group in the site's tax settings, by setting a rate or by choosing a tax code for an automated tax calculator.  Available only when `taxable` is `true`.  Default: Your app's default tax group, if you provide one with the [Tax Groups Integration service plugin](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/tax-groups-integration-service-plugin/introduction.md). Otherwise, the `Additional fees` default tax group.  | validation: format GUID
        - name: taxableAddress | type: TaxableAddress | description: Address type to calculate tax against for this fee.  Available only when `taxable` is `true`.  
           - ONE-OF: 
              - name: addressType | type: TaxableAddressType | description: taxable address type. if this field is selected, the address is automatically resolved, and the tax is calculated accordingly.  
                     - enum: BUSINESS, BILLING, SHIPPING
     - name: lineItemIds | type: array<string> | description: IDs of line items this fee applies to. Use this to associate the fee with specific items in the cart. For example, a fragile packaging fee might only apply to breakable items.  If empty, the fee applies to the entire order.  | validation: format GUID
     - name: translatedName | type: string | description: Translated display name of the fee. When provided, this value is shown to the site visitor instead of `name`.  Use this field to provide localized fee names based on the site visitor's language preferences.  | validation: minLength 1, maxLength 50
  - name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217) format. Must match the currency of the Wix site where the fees are being calculated — if it doesn't match, the fees in this response are silently filtered out and not applied to the order.  | validation: maxLength 3


```

### Examples

### Calculate additional fees - decoded JWT
The data payload will include the following object as an encoded JWT. For the purposes of this example, we show the request and response objects decoded.

```curl
curl -X POST https://provider.example.com/v1/calculate-additional-fees \
  -H 'user-agent: Wix' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'content-type: text/plain; charset=utf-8' \
  -d '{
      "data": {
        "request": {
          "appliedDiscounts": [
            {
              "coupon": {
                "amount": "10",
                "code": "summersale",
                "id": "b8773880-5969-4771-a11f-d3808eccfb69",
                "name": ""
              },
              "discountType": "SPECIFIC_ITEMS",
              "lineItemIds": [
                "00000000-0000-0000-0000-000000000001"
              ]
            }
          ],
          "lineItems": [
            {
              "catalogReference": {
                "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
                "catalogItemId": "05412fb8-e344-f4c1-3b00-903a2573e377"
              },
              "id": "00000000-0000-0000-0000-000000000001",
              "physicalProperties": {
                "shippable": true
              },
              "price": "2.00",
              "productName": "Clamping Tool",
              "quantity": 100
            }
          ],
          "buyerDetails": {
            "contactDetails": {
              "phone": "6175551905",
              "email": "bowlbuyer@example.com"
            }
          },
          "purchaseFlowId": "12b907dd-4a6c-47e7-9397-23e4afcba792",
          "shippingInfo": {
            "selectedCarrierServiceOption": {
              "code": "pickup-00000000-0000-0000-0000-000000000001",
              "cost": {
                "price": "0"
              },
              "logistics": {
                "deliveryTime": "Next Sunday at 13:00",
                "instructions": "Go to my house",
                "pickupDetails": {
                  "businessLocation": true,
                  "pickupMethod": "STORE_PICKUP"
                }
              },
              "title": "Pickup Name"
            }
          },
          "subtotal": "200.00"
        }
      }
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.additionalFees.calculateAdditionalFees(request, metadata)
 Description: Requests calculation of additional fees from the service plugin implementer for a given cart or checkout.  Wix calls this method when a site visitor views their cart, begins checkout, or when cart contents change during the checkout process.  Wix uses the returned additional fees to display line items on the cart and checkout pages and to calculate the final order total.  Your implementation must respond within 3 seconds. Longer response times result in timeout errors.  **Restrictions:** Do not call the Estimate Cart Totals, Estimate Current Cart Totals, or Get Checkout methods from your implementation. Doing so results in a runtime error.  **Error handling:** If your implementation returns an error or times out, Wix proceeds without additional fees. The site visitor won't see additional fees on their cart or checkout.
 Method parameters:
   param name: request | type: CalculateAdditionalFeesRequest | description: Request to calculate additional fees.  
        - name: lineItems | type: array<LineItem> | description: Line items in the cart or checkout. Each line item represents a product with quantity and pricing information.  | validation: maxItems 300
           - name: _id | type: string | description: Line item GUID.  | validation: minLength 1, maxLength 100
           - name: quantity | type: integer | description: Number of this item in the cart or checkout.  | validation: minimum 0, maximum 100000, format int32
           - name: catalogReference | type: CatalogReference | description: Reference to the product in the catalog. Contains the catalog app GUID and product information.  
              - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to.  | validation: minLength 1, maxLength 36
              - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
              - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  
           - name: productName | type: string | description: Name of the product. Displayed to the site visitor on cart and checkout pages.  | validation: minLength 0, maxLength 200
           - name: price | type: string | description: Price per unit of the product.  | validation: decimalValue {"gte":"0"}
           - name: physicalProperties | type: PhysicalProperties | description: Physical properties of the product, such as weight and dimensions. Used for calculating shipping costs and fees that depend on product characteristics.  
              - name: weight | type: number | description: Line item weight. Measurement unit matches the weight unit specified in `weightUnit` in the request.  
              - name: sku | type: string | description: Stock-keeping unit. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).  | validation: maxLength 40
              - name: shippable | type: boolean | description: Whether this line item is shippable.  
              - name: productDimensions | type: Dimensions | description: Product dimensions (length, width, height of the physical product).  
                 - name: length | type: string | description: Length. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                 - name: width | type: string | description: Width. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                 - name: height | type: string | description: Height. Measurement unit is handled at the system level (metric/imperial).  | validation: decimalValue {"gte":"0","lte":"999999999","maxScale":6}
                 - name: unit | type: DimensionsUnit | description: Unit of measurement for dimensions (length, width, height).  
                         - enum:
                         -     UNKNOWN_DIMENSIONS_UNIT: 
                         -     MM: Millimeters.
                         -     CM: Centimeters.
                         -     M: Meters.
                         -     IN: Inches.
                         -     FT: Feet.
                         -     YD: Yards.
              - name: packageDimensions | type: Dimensions | description: Package dimensions (length, width, height of the shipping package).  
           - name: depositAmount | type: string | description: Deposit amount required for this line item. For example, a bottle deposit for beverages.  | validation: format DECIMAL_VALUE
           - name: modifierGroups | type: array<ModifierGroup> | description: Product options selected for this line item. For example, size, color, or custom engraving. Each modifier group represents a type of option, such as "Size" with values like "Small", "Medium", "Large".  | validation: maxItems 25
              - name: _id | type: string | description: Modifier group GUID.  | validation: minLength 1, maxLength 36
              - name: name | type: TranslatableString | description: Modifier group name.  
                 - name: original | type: string | description: __Required.__ String in the site's default language as defined in the [request envelope](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/backend-extensions/add-self-hosted-service-plugin-extensions.md#request-envelope).  Min: 1 character. Max: 200 characters.  | validation: minLength 1, maxLength 200
                 - name: translated | type: string | description: String translated into the buyer's language.  Min: 1 character. Max: 400 characters. Default: Same as `original`.  | validation: minLength 1, maxLength 400
              - name: modifiers | type: array<ItemModifier> | description: List of modifiers in this group.  | validation: minItems 1, maxItems 25
                 - name: _id | type: string | description: Modifier GUID.  | validation: minLength 1, maxLength 36
                 - name: quantity | type: integer | description: The quantity of this modifier.  | validation: minimum 1, maximum 100000, format int32
                 - name: label | type: TranslatableString | description: Primary display label for the modifier.  
                 - name: details | type: TranslatableString | description: Additional details.  
                 - name: price | type: string | description: The price of the modifier.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":3}
        - name: shippingAddress | type: Address | description: Address where the order will be shipped. Used to calculate location-based fees or determine applicable regulations.  
           - name: streetAddress | type: StreetAddress | description: none  
              - name: name | type: string | description: none  
              - name: number | type: string | description: none  
           - name: city | type: string | description: none  
           - name: subdivision | type: string | description: none  
           - name: country | type: string | description: none  
           - name: postalCode | type: string | description: none  
           - name: addressLine2 | type: string | description: none  
        - name: buyerDetails | type: BuyerDetails | description: Information about the buyer making the purchase.  
           - name: contactDetails | type: FullAddressContactDetails | description: Contact information for the buyer, including name, email, phone number, and address.  
              - name: firstName | type: string | description: Contact's first name.  
              - name: lastName | type: string | description: Contact's last name.  
              - name: phone | type: string | description: Contact's phone number.  | validation: format PHONE
              - name: company | type: string | description: Contact's company name.  
              - name: email | type: string | description: Email associated with the address.  | validation: format EMAIL
              - name: vatId | type: VatId | description: Tax info. Currently usable only in Brazil.  
                 - name: _id | type: string | description: Customer's tax GUID.  
                 - name: type | type: VatType | description: Tax type.  Supported values: + `CPF`: for individual tax payers + `CNPJ`: for corporations  
                         - enum:
                         -     UNSPECIFIED: 
                         -     CPF: CPF - for individual tax payers.
                         -     CNPJ: CNPJ - for corporations
        - name: appliedDiscounts | type: array<AppliedDiscount> | description: Discounts applied to the cart or checkout. Includes coupons, merchant discounts, and discount rules.  | validation: maxItems 320
           - ONE-OF: 
              - name: coupon | type: Coupon | description: Coupon code applied by the site visitor.  
                 - name: _id | type: string | description: Coupon GUID.  
                 - name: code | type: string | description: Coupon code entered by the site visitor. For example, "SUMMER20" or "WELCOME10".  
                 - name: name | type: string | description: Display name of the coupon. Shown to the site visitor on the cart and checkout pages.  
                 - name: amount | type: string | description: Discount amount provided by the coupon. Can represent a fixed amount or a calculated percentage discount value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
              - name: merchantDiscount | type: MerchantDiscount | description: Manual discount applied by the merchant during checkout or order processing.  
                 - name: amount | type: string | description: Discount amount applied by the merchant.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
              - name: discountRule | type: DiscountRule | description: Automatic discount rule configured by the merchant.  
                 - name: _id | type: string | description: Discount rule GUID.  | validation: format GUID
                 - name: name | type: DiscountRuleName | description: Name of the discount rule in original and translated forms.  
                    - name: original | type: string | description: Original name of the discount rule as configured by the merchant.  | validation: minLength 1, maxLength 256
                    - name: translated | type: string | description: Translated name of the discount rule. When provided, this value is displayed to the site visitor instead of `original`.  | validation: minLength 1, maxLength 500
                 - name: amount | type: string | description: Discount amount applied by the rule. Can represent a fixed amount or a calculated percentage discount value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
           - name: discountType | type: DiscountType | description: Type of this discount.  
                 - enum:
                 -     GLOBAL: Discount applies to the entire order.
                 -     SPECIFIC_ITEMS: Discount applies only to specific items in the cart.
                 -     SHIPPING: Discount applies to shipping costs.
           - name: lineItemIds | type: array<string> | description: IDs of line items this discount applies to.  Available only when `discountType` is `SPECIFIC_ITEMS`.  | validation: format GUID
        - name: shippingInfo | type: ShippingInformation | description: Information about the selected shipping method and its associated costs.  
           - name: selectedCarrierServiceOption | type: SelectedCarrierServiceOption | description: Shipping method and carrier selected by the site visitor.  
              - name: code | type: string | description: Unique code identifying the carrier service. For example, "usps-priority" or "fedex-ground".  | validation: maxLength 100
              - name: otherCharges | type: array<SelectedCarrierServiceOptionOtherCharge> | description: Additional charges associated with the shipping method, such as handling fees or insurance.  | validation: maxItems 100
                 - name: type | type: ChargeType | description: Type of charge.  
                         - enum:
                         -     HANDLING_FEE: Handling fee charged for processing the shipment.
                         -     INSURANCE: Insurance fee to protect the shipment during transit.
                 - name: details | type: string | description: Additional details about the charge. For example, "Signature required" for insurance.  | validation: maxLength 200
                 - name: cost | type: SelectedCarrierServiceOptionPrices | description: Cost of the additional charge.  
                    - name: price | type: string | description: Base price of the shipping method before discounts.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
                    - name: totalDiscount | type: string | description: Total discount amount applied to the shipping cost.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
        - name: purchaseFlowId | type: string | description: Persistent GUID that correlates between the various eCommerce elements: cart, checkout, and order. Use this to tie additional-fee calculations to a specific purchase flow across the cart, checkout, and resulting order.  | validation: format GUID
        - name: businessLocationId | type: string | description: GUID of the business location fulfilling the order. Learn more about the [Locations API](https://dev.wix.com/docs/rest/business-management/locations/introduction.md).  | validation: format GUID
        - name: subtotal | type: string | description: Subtotal of all line items before additional fees, shipping, and tax. Calculated as the sum of `lineItems[i].price * lineItems[i].quantity` across all line items. Whether already-applied discounts are reflected in this value depends on `itemDiscountsAppliedToPrices` and the cart's discount-application mode.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":3}
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the cart or checkout.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: sitePaymentMethodTypeId | type: string | description: GUID of the site payment method type the customer selected to pay with. Learn more about the [Site Payment Method Types API](https://dev.wix.com/docs/api-reference/business-management/payments/site-payment-method-types/introduction.md).  Available only when the customer selects a payment method during the purchase flow.  | validation: format GUID
   param name: metadata | type: Context | description: this message is not directly used by any service, it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform. e.g. SPIs, event-handlers, etc.. NOTE: this context object MUST be provided as the last argument in each Velo method signature.  Example: ```typescript export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) { ... } ```  
        - name: requestId | type: string | description: A unique identifier of the request. You may print this GUID to your logs to help with future debugging and easier correlation with Wix's logs.  
        - name: currency | type: string | description: [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.  | validation: format CURRENCY
        - name: identity | type: IdentificationData | description: An object that describes the identity that triggered this request.  
           - ONE-OF: 
              - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.  | validation: format GUID
              - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.  | validation: format GUID
              - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).  | validation: format GUID
              - name: appId | type: string | description: GUID of an app.  | validation: format GUID
        - name: languages | type: array<string> | description: A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`.  
        - name: instanceId | type: string | description: The service provider app's instance GUID.  | validation: format GUID
 Return type: PROMISE<CalculateAdditionalFeesResponse>
  - name: additionalFees | type: array<AdditionalFee> | description: Additional fees calculated for the cart or checkout. Each fee represents a separate line item that will be added to the order total.  | validation: maxItems 100
     - name: code | type: string | description: Unique code identifying the type of fee. For example, `fragile-packaging` or `gift-wrap`. Used for internal tracking and reporting.  | validation: minLength 1, maxLength 100
     - name: name | type: string | description: Display name of the fee shown to the site visitor on the cart and checkout pages. For example, "Fragile Packaging Fee" or "Gift Wrapping".  | validation: minLength 1, maxLength 50
     - name: price | type: string | description: Price of the fee, excluding any tax. This amount is added to the order total.  If `taxDetails.taxable` is `true`, Wix calculates tax on top of this price — do not include tax in this value.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
     - name: taxDetails | type: TaxDetails | description: Tax information for the fee. Determines whether the fee is taxable and which tax rules apply.  
        - name: taxable | type: boolean | description: Whether the fee is subject to tax. When `true`, Wix applies the site's tax rules to calculate tax on the fee amount.  Default: `false`  
        - name: taxGroupId | type: string | description: GUID of the tax group that defines tax rates and rules for this fee.  Wix treats an GUID that doesn't match a tax group on the site as if you didn't set `taxGroupId`.  A fee in the `Additional fees` default tax group isn't taxed until a Wix user configures tax for that group in the site's tax settings, by setting a rate or by choosing a tax code for an automated tax calculator.  Available only when `taxable` is `true`.  Default: Your app's default tax group, if you provide one with the [Tax Groups Integration service plugin](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/tax-groups-integration-service-plugin/introduction.md). Otherwise, the `Additional fees` default tax group.  | validation: format GUID
        - name: taxableAddress | type: TaxableAddress | description: Address type to calculate tax against for this fee.  Available only when `taxable` is `true`.  
           - ONE-OF: 
              - name: addressType | type: TaxableAddressType | description: taxable address type. if this field is selected, the address is automatically resolved, and the tax is calculated accordingly.  
                     - enum: BUSINESS, BILLING, SHIPPING
     - name: lineItemIds | type: array<string> | description: IDs of line items this fee applies to. Use this to associate the fee with specific items in the cart. For example, a fragile packaging fee might only apply to breakable items.  If empty, the fee applies to the entire order.  | validation: format GUID
     - name: translatedName | type: string | description: Translated display name of the fee. When provided, this value is shown to the site visitor instead of `name`.  Use this field to provide localized fee names based on the site visitor's language preferences.  | validation: minLength 1, maxLength 50
  - name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217) format. Must match the currency of the Wix site where the fees are being calculated — if it doesn't match, the fees in this response are silently filtered out and not applied to the order.  | validation: maxLength 3


```

### Examples

### Example of an `additionalFees` return value
```javascript
import { additionalFees } from '@wix/ecom/service-plugins';

additionalFees.provideHandlers({

  calculateAdditionalFees: async ( payload ) => {
    const {request, metadata} = payload;
        // Use the `request` and `metadata` received from Wix and
        // apply custom logic.
      return {
        // Return your response exactly as documented to integrate with Wix.
        // Return value example:
        additionalFees: [
          {
            code: "subscription-fee",
            name: "Subscription Fee",
            price: "5",
            taxDetails: {
              taxable: true
            }
          }
        ],
        currency: "USD"
      }
    }
});

```

### calculateAdditionalFees (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { additionalFees } from '@wix/ecom/service-plugins';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { additionalFees },
  // Include the auth strategy and host as relevant
});


async function calculateAdditionalFees(request,metadata) {
  const response = await myWixClient.additionalFees.calculateAdditionalFees(request,metadata);
};
```

---