As a validation service provider, you can integrate your service with Wix's cart and checkout to allow merchants to request and use your services on their Wix sites. By integrating your service with Wix, the validations are performed on the site visitor's cart and checkout.
The integration is done via an app in the Wix App Market (created in the Wix Developers Center) and the Wix Validations SPI.
Future functionality includes validating products and orders.
Learn more about implementing an SPI with Wix.
By default, the Validations SPI only validates a site visitor's checkout. If you want to also validate a site visitor's cart, set the validateInCart
parameter to true
in the extension’s configuration file in the Wix Developers Center.
Using the SPI, you can design your app to validate a cart and checkout for your merchant's customers, including:
- Minimum cart value.
- Age of a customer before they proceed to checkout.
- Line item quantity limit.
- Valid coupon code.
- Specific items to ship only to specific regions.
- Restrict purchases to site members only.
- Close the checkout on certain days.
To enable Wix to communicate with your app:
- 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 Validations and click Create.
- Provide the following configuration:
Name | Type | Description |
---|---|---|
deploymentUri | string | Required. Base URI which Wix eCommerce will call to retrieve the validation violations. For example, "deploymentUri": "https://my-validations.com" |
componentName | string | A unique name for this component. This is an internal name that will only appear in the Dev Center. |
validateInCart | boolean | Whether to validate the cart page in addition to the checkout page. Default: false |
Term | Definition |
---|---|
Merchant | Business that offers products on their Wix site to customers. |
Severity | How severe the violation is. The violations are shown on the cart and checkout pages. A warning is displayed as yellow, and allows a site visitor to proceed with caution. An error is displayed as red, and doesn't allow a site visitor to proceed with the eCommerce flow. |
Subscription Option | A store owner can create subscriptions to sell their products on a recurring basis. A line item can be a subscription. |
Target | Target location on a checkout or cart page where the violation will be displayed. The target violation can either be in a particular lineItem , or in an other area of the cart or checkout page. |
Validation Service Provider | A 3rd-party app that implements custom logic to validate the site's cart or checkout. |
Violations | A list of any validation violations in a site visitor's cart or checkout. |
Wix site owner | The person managing the merchant's Wix site. |
This article presents sample flows 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 Validations integration.
-
A site visitor adds a coupon code to their Wix checkout.
-
Wix sends a Get Validation Violations SPI request to your app.
-
Your server validates the request. If the coupon code is valid, the validation is sucessful and the SPI returns an object containing an empty list. If the coupon isn't valid, the validation isn't successful. In this case, Wix eCommerce expects an object containing the validation violations, and the severity and target of the violations.
Example of a violations response from your app:
Copy Code{"violations": [{"severity": "ERROR","target": {"other": {"name": "OTHER_DEFAULT"}},"description": "Can't apply coupon because minimum cart value has not been reached.",}]} -
With this validation violation, the site visitor can't proceed with the checkout.
In this flow, due to limited quantity of white wine, a site visitor can't add more than 5 cases of white wine to their cart.
When configuring your app in the Wix Developers Center, use these sample settings:
When configuring your app in the Wix Developers Center, set the validateInCart
property to true
in the extension’s configuration file. This validates a site visitor's cart in addition to a site visitor's checkout.
-
A site visitor adds 6 cases of white wine to their cart, which is over the amount that is permitted.
-
Wix sends a Get Validation Violations SPI request to your app.
-
Your server validates the request and finds it unsuccessful. Wix eCommerce expects an object containing the validation violations, and the severity and target of the violations.
Example of a violations response from your app:
Copy Code{"violations": {"severity": "ERROR","target": {"other": {"name": "LINE_ITEM_DEFAULT"}},"description": "Can't proceed with checkout. Remove 1 case of white wine from your cart.",}} -
After this validation violation, the site visitor removes 1 case of white wine to proceed to Wix Checkout.
-
Again Wix sends a Get Validation Violations SPI request to your app.
-
Your server validates the request and finds it successful. In this case, Wix eCommerce expects an object containing an empty list.
This endpoint retrieves validation violations from your app.
Wix calls this endpoint when certain actions are performed on a visitor's cart and checkout. For example, when an item is added to the cart, or when a coupon is added to a checkout. This endpoint validates a visitor's cart and checkout, and returns any validation violations (using the structure provided by Wix eCommerce). Site visitors can see the validation violations in their cart and checkout pages. If there aren't any validation violations, the endpoint returns an object containing an empty list.
Notes:
- By default, this endpoint only retrieves validation violations from a visitor's checkout. If you want to also retrieve validation violations from a visitor's cart, set the
validateInCart
parameter totrue
in the Ecom Validations Integration's config file located in the Wix Developers Center. For more information, see the prerequisites section of the introduction.- 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.