> 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

# GetShippingRates

# Package: shippingRates

# Namespace: ShippingRates

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates.md

## Introduction

This method retrieves applicable shipping rates for a delivery from your app.

Wix calls this method when certain actions are performed on the cart and/or checkout. For example, when an item is added to the cart, or the shipping destination is changed.

> __Note:__ Do not call the Estimate Cart Totals, Estimate Current Cart Totals or Get Checkout methods from your implementation code for Get Shipping Rates. Doing so will result in an error.

---

## REST API

### Schema

```
 Method: getShippingRates
 Description: This method retrieves applicable shipping rates for a delivery from your app.  Wix calls this method when certain actions are performed on the cart and/or checkout. For example, when an item is added to the cart, or the shipping destination is changed.  > __Note:__ Do not call the Estimate Cart Totals, Estimate Current Cart Totals or Get Checkout methods from your implementation code for Get Shipping Rates. Doing so will result in an error.
 URL: {DEPLOYMENT-URI}/v1/getRates
 Method: POST
 Method parameters:
   param name: buyerContactDetails | type: FullAddressContactDetails | description: Full contact details for an 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: deliveryPreferences | type: DeliveryPreferences | description: delivery preferences, for example preferred delivery "code" (shippingOptionId). enrich the delivery providers with more data about the delivery  
        - name: preferredCode | type: string | description:   
   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: externalReferences | type: array<externalReferences> | description: Reference to an external resource GUID. Used to link the purchase flow to a specific entity in an external system. Used for integration and tracking across different platforms.  | validation: maxItems 20
              - name: appId | type: string | description: GUID of the app associated with the purchase flow. For example, the Wix Pay Links app GUID.  | validation: format GUID, immutable
              - name: resourceId | type: string | description: Reference to an external resource GUID. Used to link the purchase flow to a specific entity in an external system. For example, a Wix Pay Link GUID.  | validation: minLength 1, maxLength 100, immutable
   param name: lineItems | type: array<lineItems> | description: The line items to be shipped.  | validation: minItems 1, maxItems 500
              - name: name | type: string | description: Item name.  
              - name: quantity | type: integer | description: The number of items ordered.  | validation: minimum 0, maximum 999999999
              - name: catalogReference | type: CatalogReference | description: Reference to the item's origin catalog.  
                 - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | 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 a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  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: physicalProperties | type: PhysicalProperties | description: Physical properties of the item.  
                 - 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: price | type: string | description: Price of a single item after discounts.  | validation: format DECIMAL_VALUE
              - name: totalPriceBeforeDiscount | type: string | description: Total line item price before discounts.  | validation: format DECIMAL_VALUE
              - name: priceBeforeDiscount | type: string | description: Price of a single item before discounts.  | validation: format DECIMAL_VALUE
              - name: totalPrice | type: string | description: Total line item price after discounts. This is equal to `price` multiplied by `quantity`.  | validation: format DECIMAL_VALUE
              - name: deliveryDestinationIndex | type: integer | description: item delivery destination index in the shipping addresses list  | validation: format int32
              - name: deliveryOriginIndex | type: integer | description: where the item is delivered from index in the from addresses list  | validation: format int32
              - name: taxIncludedInPrice | type: boolean | description: whether tax is included in line item price  
   param name: purchaseFlowId | type: purchaseFlowId | description: Persistent GUID that correlates between the various eCommerce elements: cart, checkout, and order.  | validation: format GUID
   param name: shippingDestination | type: Address | description: Physical address  
    - ONE-OF: 
     - name: streetAddress | type: StreetAddress | description: Street name and number.  
        - name: number | type: string | description: Street number.  
        - name: name | type: string | description: Street name.  
     - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
        - name: country | type: string | description: Country code.  | validation: format COUNTRY
        - name: subdivision | type: string | description: Subdivision shorthand. Usually, a short code (2 or 3 letters) that represents a state, region, prefecture, or province. e.g. NY  
        - name: city | type: string | description: City name.  
        - name: postalCode | type: string | description: Zip/postal code.  
        - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor.  
   param name: shippingOrigin | type: Address | description: Physical address  
    - ONE-OF: 
        - name: country | type: string | description: Country code.  | validation: format COUNTRY
        - name: subdivision | type: string | description: Subdivision shorthand. Usually, a short code (2 or 3 letters) that represents a state, region, prefecture, or province. e.g. NY  
        - name: city | type: string | description: City name.  
        - name: postalCode | type: string | description: Zip/postal code.  
        - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor.  
   param name: taxIncludedInPrices | type: taxIncludedInPrices | description: Whether tax is included in the items' prices.  
   param name: weightUnit | type: WeightUnit    
      - enum:
           UNSPECIFIED_WEIGHT_UNIT - Weight unit can't be classified due to an error.
           KG - Kilograms.
           LB - Pounds.
 Return type: GetShippingRatesResponse
  - name: shippingRates | type: array<ShippingOption> | description: Available shipping rates. These define the shipping rate options that are displayed to site visitors on the cart and checkout pages.  
     - name: code | type: string | description: Unique code that acts as an GUID for a shipping rate. For example, `"usps_std_overnight"`.  
     - name: title | type: string | description: Shipping rate title. For example, `"USPS Standard Overnight Delivery"`, `"Standard"`, or `"First-Class Package International"`.  
     - name: logistics | type: DeliveryLogistics | description: Shipping logistics.  
        - name: deliveryTime | type: string | description: When the item is expected to be delivered in free text. For example, `"3-5 business days"`.  
        - name: instructions | type: string | description: Instructions for delivery. For example, for pickup: `"Ensure to come during business hours, and please don't park in the disabled spot"`.  
        - name: pickupDetails | type: PickupDetails | description: Pickup details. Should be returned only if order is for pickup.  
           - name: address | type: Address | description: Pickup address.  
              - ONE-OF: 
                 - name: streetAddress | type: StreetAddress | description: Street name and number.  
                    - name: number | type: string | description: Street number.  
                    - name: name | type: string | description: Street name.  
                 - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
              - name: country | type: string | description: Country code.  | validation: format COUNTRY
              - name: subdivision | type: string | description: Subdivision shorthand. Usually, a short code (2 or 3 letters) that represents a state, region, prefecture, or province. e.g. NY  
              - name: city | type: string | description: City name.  
              - name: postalCode | type: string | description: Zip/postal code.  
              - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor.  
           - name: pickupMethod | type: PickupMethod | description: Pickup method.  Supported values: + `"STORE_PICKUP"`: When pickup is from the merchant's brick and mortar store. + `"PICKUP_POINT"`: When item is shipped to a specified pickup point.  
                 - enum: STORE_PICKUP, PICKUP_POINT
     - name: cost | type: ShippingPrice | description: Shipping cost.  
        - name: price | type: string | description: The shipping rate's price. Must align with the [currency's decimal separator](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).  | validation: format DECIMAL_VALUE
        - name: currency | type: string | description: Currency of the shipping rate price as a 3-letter [ISO-4217 currency code](https://en.wikipedia.org/wiki/ISO_4217). Must align with the `currency` passed to the function under the `metadata` field.  | validation: format CURRENCY
        - name: additionalCharges | type: array<AdditionalCharge> | description: Additional costs. For example, a handling fee for packaging fragile items.  
           - name: type | type: ChargeType | description: Additional charge type.  
                 - enum: HANDLING_FEE
           - name: details | type: string | description: Details of the additional charge. For example, `"Handling fee of $5 applied for gift wrapping"`.  
           - name: price | type: string | description: Cost of additional charge. For example, `12.5`.  | validation: format DECIMAL_VALUE

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: GENERIC_ERROR | Description: Generic shipping rate calculation error.  Throw this error for cases the other errors don't cover. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PARTIAL_ADDRESS | Description: Invalid address error.  Throw this error when one or more fields in the address provided are invalid. This error tells Wix that more address details are needed to calculate the shipping rate. Wix may then prompt the user to provide more detailed address information. The error data must include the invalid fields in the address. For example: `ShippingDestination.subdivision`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_POSTAL_CODE | Description: Invalid postal code error.  Throw this error when an invalid postal code is provided in the request. This error tells Wix that a valid postal code is required to calculate the shipping rate. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_POSTAL_CODE | Description: Missing postal code error.  Throw this error when a postal code is not provided in the request. This error tells Wix that a valid postal code is required to calculate the shipping rate. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.


```

### Examples

### Get shipping rates - 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/getRates \
    -H 'user-agent: Wix' \
    -H 'accept-encoding: gzip, deflate' \
    -H 'content-type: text/plain; charset=utf-8' \
    -d '{
        "data": {
          "request": {
            "lineItems": [
              {
                "physicalProperties": {
                  "weight": 0.4,
                  "sku": "",
                  "shippable": true
                },
                "name": "coffee mug",
                "quantity": 1,
                "price": "100.00",
                "catalogReference": {
                  "catalogItemId": "50b7223c-80e6-3539-325e-4ecfe99770dc",
                  "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
                  "options": {
                    "options": {
                      "Size": "256",
                      "Color": "blue"
                    },
                    "variantId": "9d1bc95e-d6ed-4546-b89b-c61e334e2d5e"
                  }
                }
              }
            ],
            "buyerContactDetails": {
              "phone": "123456789",
              "email": "janedoe@gmail.com"
            },
            "taxIncludedInPrices": false,
            "weightUnit": "LB",
            "shippingDestination": {
              "country": "US",
              "subdivision": "US-NY",
              "city": "New York",
              "postalCode": "10011",
              "addressLine": "235 West 23rd Street",
              "addressLine2": "3rd floor",
              "countryFullname": "United States",
              "subdivisionFullname": "New York"
            },
            "shippingOrigin": {
              "addressLine1": "34 Elizabeth Street",
              "addressLine2": "4th floor",
              "city": "Boston",
              "country": "US",
              "postalCode": "02108",
              "subdivision": "US-MA"
            }
          },
          "metadata": {
            "instanceId": "9698acde-2e44-4656-9db3-f48c91da9828",
            "languages": [
              "en"
            ],
            "currency": "USD",
            "requestId": "1670756264.11667254865110420",
            "identity": {
              "identityType": "ANONYMOUS_VISITOR",
              "anonymousVisitorId": "a02f16af-6174-4f3e-a1e1-6eed2735d67d"
            }
          },
          "aud": "e6a6c88b-8ed1-465b-8c10-5bb0e9285e3f",
          "iss": "wix.com",
          "iat": 1670756264,
          "exp": 1674356264
          }
        }
      }
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.shippingRates.getShippingRates(request, metadata)
 Description: This method retrieves applicable shipping rates for a delivery from your app.  Wix calls this method when certain actions are performed on the cart and/or checkout. For example, when an item is added to the cart, or the shipping destination is changed.  > __Note:__ Do not call the Estimate Cart Totals, Estimate Current Cart Totals or Get Checkout methods from your implementation code for Get Shipping Rates. Doing so will result in an error.
 Method parameters:
   param name: request | type: GetShippingRatesRequest    
        - name: lineItems | type: array<ProductItem> | description: The line items to be shipped.  | validation: minItems 1, maxItems 500
           - name: name | type: string | description: Item name.  
           - name: quantity | type: integer | description: The number of items ordered.  | validation: minimum 0, maximum 999999999
           - name: catalogReference | type: CatalogReference | description: Reference to the item's origin catalog.  
              - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | 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 a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  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: physicalProperties | type: PhysicalProperties | description: Physical properties of the item.  
              - 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: price | type: string | description: Price of a single item after discounts.  | validation: format DECIMAL_VALUE
           - name: totalPriceBeforeDiscount | type: string | description: Total line item price before discounts.  | validation: format DECIMAL_VALUE
           - name: priceBeforeDiscount | type: string | description: Price of a single item before discounts.  | validation: format DECIMAL_VALUE
           - name: totalPrice | type: string | description: Total line item price after discounts. This is equal to `price` multiplied by `quantity`.  | validation: format DECIMAL_VALUE
           - name: deliveryDestinationIndex | type: integer | description: item delivery destination index in the shipping addresses list  | validation: format int32
           - name: deliveryOriginIndex | type: integer | description: where the item is delivered from index in the from addresses list  | validation: format int32
           - name: taxIncludedInPrice | type: boolean | description: whether tax is included in line item price  
        - name: shippingDestination | type: Address | description: Address to ship to.  
           - name: location | type: Location | description: none  
              - name: latitude | type: number | description: none  
              - name: longitude | type: number | description: none  
           - 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: formatted | type: string | description: none  
           - name: addressLine1 | type: string | description: none  
           - name: addressLine2 | type: string | description: none  
        - name: shippingOrigin | type: Address | description: Address item is shipped from. This is the site owner's business address.  
        - name: buyerContactDetails | type: FullAddressContactDetails | description: Buyer's contact details.  
           - 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: weightUnit | type: WeightUnit | description: Weight measurement unit used for all items in the shipment.  Supported values: + `"KG"`: kilograms + `"LB"`: pounds  
             - enum:
             -     UNSPECIFIED_WEIGHT_UNIT: Weight unit can't be classified due to an error.
             -     KG: Kilograms.
             -     LB: Pounds.
        - name: deliveryPreferences | type: DeliveryPreferences | description: List of delivery preferences, for example preferred delivery code (`shippingOptionId`).  
           - name: preferredCode | type: string | description:   
        - name: purchaseFlowId | type: string | description: Persistent GUID that correlates between the various eCommerce elements: cart, checkout, and order.  | validation: format GUID
        - name: externalReferences | type: array<ExternalReference> | description: Reference to an external resource GUID. Used to link the purchase flow to a specific entity in an external system. Used for integration and tracking across different platforms.  | validation: maxItems 20
           - name: appId | type: string | description: GUID of the app associated with the purchase flow. For example, the Wix Pay Links app GUID.  | validation: format GUID, immutable
           - name: resourceId | type: string | description: Reference to an external resource GUID. Used to link the purchase flow to a specific entity in an external system. For example, a Wix Pay Link GUID.  | validation: minLength 1, maxLength 100, immutable
        - name: extendedFields | type: ExtendedFields | description: [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  
           - 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: 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<GetShippingRatesResponse>
  - name: shippingRates | type: array<ShippingOption> | description: Available shipping rates. These define the shipping rate options that are displayed to site visitors on the cart and checkout pages.  
     - name: code | type: string | description: Unique code that acts as an GUID for a shipping rate. For example, `"usps_std_overnight"`.  
     - name: title | type: string | description: Shipping rate title. For example, `"USPS Standard Overnight Delivery"`, `"Standard"`, or `"First-Class Package International"`.  
     - name: logistics | type: DeliveryLogistics | description: Shipping logistics.  
        - name: deliveryTime | type: string | description: When the item is expected to be delivered in free text. For example, `"3-5 business days"`.  
        - name: instructions | type: string | description: Instructions for delivery. For example, for pickup: `"Ensure to come during business hours, and please don't park in the disabled spot"`.  
        - name: pickupDetails | type: PickupDetails | description: Pickup details. Should be returned only if order is for pickup.  
           - name: address | type: Address | description: Pickup address.  
              - name: location | type: Location | description: none  
                 - name: latitude | type: number | description: none  
                 - name: longitude | type: number | description: none  
              - 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: formatted | type: string | description: none  
              - name: addressLine1 | type: string | description: none  
              - name: addressLine2 | type: string | description: none  
           - name: pickupMethod | type: PickupMethod | description: Pickup method.  Supported values: + `"STORE_PICKUP"`: When pickup is from the merchant's brick and mortar store. + `"PICKUP_POINT"`: When item is shipped to a specified pickup point.  
                 - enum: STORE_PICKUP, PICKUP_POINT
     - name: cost | type: ShippingPrice | description: Shipping cost.  
        - name: price | type: string | description: The shipping rate's price. Must align with the [currency's decimal separator](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).  | validation: format DECIMAL_VALUE
        - name: currency | type: string | description: Currency of the shipping rate price as a 3-letter [ISO-4217 currency code](https://en.wikipedia.org/wiki/ISO_4217). Must align with the `currency` passed to the function under the `metadata` field.  | validation: format CURRENCY
        - name: additionalCharges | type: array<AdditionalCharge> | description: Additional costs. For example, a handling fee for packaging fragile items.  
           - name: type | type: ChargeType | description: Additional charge type.  
                 - enum: HANDLING_FEE
           - name: details | type: string | description: Details of the additional charge. For example, `"Handling fee of $5 applied for gift wrapping"`.  
           - name: price | type: string | description: Cost of additional charge. For example, `12.5`.  | validation: format DECIMAL_VALUE

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: GENERIC_ERROR | Description: Generic shipping rate calculation error.  Throw this error for cases the other errors don't cover. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PARTIAL_ADDRESS | Description: Invalid address error.  Throw this error when one or more fields in the address provided are invalid. This error tells Wix that more address details are needed to calculate the shipping rate. Wix may then prompt the user to provide more detailed address information. The error data must include the invalid fields in the address. For example: `ShippingDestination.subdivision`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_POSTAL_CODE | Description: Invalid postal code error.  Throw this error when an invalid postal code is provided in the request. This error tells Wix that a valid postal code is required to calculate the shipping rate. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_POSTAL_CODE | Description: Missing postal code error.  Throw this error when a postal code is not provided in the request. This error tells Wix that a valid postal code is required to calculate the shipping rate. You can optionally provide error data to help debug the issue. Error data you provide appears in the monitoring log but is not exposed to the user. This error may block the site visitor from proceeding to checkout, so throw it only if there is no other way to proceed.


```

### Examples

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

shippingRates.provideHandlers({

  getShippingRates: 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:
        shippingRates: [
          {
            code: "usps-international",
            title: "USPS - International",
            logistics: {
              deliveryTime: "2-5 days",
            },
            cost: {
              price: "15",
              currency: "USD",
              additionalCharges: [
                {
                  price: "10",
                  type: "HANDLING_FEE",
                  details: "Handling fee of $5 applied for fragile items.",
                }
              ]
            }
          }
        ]
      }
    }
});

```

### getShippingRates (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 { shippingRates } 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: { shippingRates },
  // Include the auth strategy and host as relevant
});


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

---