As a shipping provider, you can integrate your shipping rates service with Wix to allow a merchant's stores or businesses to request and use your shipping services on their Wix sites. The shipping rates are then displayed on the site's cart and checkout pages.
The integration is done via an app in the Wix App Market (created in the Wix Developers Center) and the Wix Shipping Rates SPI.
Using the SPI, you can design your app to:
- Provide shipping estimates, including fees and times.
- Provide shipping rates using your own custom logic.
- Provide services for delivery and pickup.
Learn more about implementing an SPI with Wix.
- Get Shipping Rates: Wix calls this SPI endpoint to retrieve the shipping rates you provide.
- Merchant: Business that offers products on their Wix site to customers.
- Wix site owner: The person managing the merchant's Wix site.
- Shipping Rates Provider: A 3rd-party app that implements custom logic to calculate shipping rates.
Complete the following steps to adapt Wix system's integration to make your shipping rates available to merchants and their customers.
-
Create an app and retrieve its app ID either from the URL or as displayed in the My Apps dashboard in the Wix Developers Center.
-
Go to the Extensions tab in the Wix Developers Center.
-
Click Create Extension in the top right.
-
Filter by eCommerce in the left menu, then find Ecom Shipping Rates and click Create.
-
Use the JSON editor to create the extension's configuration file. Take care to include the required fields noted in the table below. Click Save.
Name Type Description deploymentUri
string Required. Base URI which Wix eCommerce will call to retrieve the shipping rates. For example, https://my-shipping-provider.com/v1/getRates
.name
string Required. Human-readable name of the shipping provider. Max characters: 64. description
string Description of the shipping provider. Max characters: 200. learnMoreUrl
string URL to more info about the shipping provider. dashboardUrl
string URL to reach the shipping provider app's dashboard. fallbackDefinitionMandatory
boolean Whether to require the site owner to define a fallback/default rate. Set to true
if you do not provide rates as part of the integration.thumbnail_url
string Thumbnail image of the shipping rates provider. Displayed in the shipping settings section in the Dashboard. The URL must be of an image uploaded to the Wix Media Manager. -
Click Test Your App.
-
After adding your app to the test site, enable a shipping rule in the dashboard to show your shipping rates during checkout.
This article presents a sample flow your app can support. You aren't limited to this exact flow, but it can be a helpful jumping off point as you plan your Shipping Rates integration.
-
A site owner installs and authorizes your 3rd-party app to provide shipping rates based on various factors (region, product weight, taxes, and so on). The app collects the JSON Web Token (JWT), decodes it, and stores the resulting instance ID.
For example, the token in this request:
Copy Code$ curl -X POST https://ext-server.com/wix-spi/account-ids-H 'Content-Type: plain/text'-d 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbnN0YW5jZUlkIjoiMDQ0NjY3ZjQtYzEzZi00NmMyLTg1MDYtZGU5ZTQyMjkzODk2In0.fxedHrnHUFi6V-S5OH8gL-pY4STxFWZHjj-xo9QUwQY'Decodes into:
Copy Code{ "instanceId": "044667f4-c13f-46c2-8506-de9e42293896" }
-
A customer logs on to the merchant’s Wix site and starts adds a product to the cart or checkout.
-
Wix sends a Get Shipping Rates SPI request to your app. The payload will include some or all of the fields described in the Body Params and example sections of the Get Shipping Rates reference.
-
Your Shipping Rates integration triggers the required flow on its platform and processes the request.
Wix expects an object containing the shipping rates, and either a 4xx HTTP status code (and some errors) or a 200 HTTP status code.
Example of a successful response from your app:
Copy Code{"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."}]}}]}Example of an error:
Copy Code{"errors": [{"code": "MISSING_POSTAL_CODE","message": "Postal Code was missing from request"}]} -
The Wix site displays the shipping rate/s on the cart or checkout page (depending on where the customer is selecting the shipping option). The customer can confirm the shipping rate before proceeding to payment.
This endpoint retrieves applicable shipping rates for a delivery from your app.
Wix calls this endpoint 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.
You cannot try out this endpoint because it has to be implemented by an app and can have an arbitrary URL. Therefore, ignore the Authorization and POST sections below as well as the Try It Out button.