POST

Get Shipping Rates


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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.

Endpoint
POST
{DEPLOYMENT-URI}/v1/getRates
Body Params
lineItemsArray <ProductItem>minItems 1maxItems 500

The line items to be shipped.


shippingDestinationShippingDestination

Address to ship to.


shippingOriginShippingOrigin

Address item is shipped from. This is the site owner's business address.


buyerContactDetailsBuyerContactDetails

Buyer's contact details.


weightUnitstring

Weight measurement unit used for all items in the shipment.

Supported values:

  • "KG": kilograms
  • "LB": pounds

taxIncludedInPricesboolean

Whether tax is included in the items' prices.


deliveryPreferencesDeliveryPreferences

List of delivery preferences, for example preferred delivery code (shippingOptionId).


purchaseFlowIdstringformat GUID

Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order.


externalReferencesArray <ExternalReference>betamaxItems 20

Reference to an external resource ID. Used to link the purchase flow to a specific entity in an external system. Used for integration and tracking across different platforms.

Response Object
shippingRatesArray <ShippingOption>

Available shipping rates. These define the shipping rate options that are displayed to site visitors on the cart and checkout pages.

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.

Request
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 } } }
Response
JSON
{ "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." } ] } } ] }
Did this help?