> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Implement Service Plugins ## Article: Implementing Service Plugins ## Article Link: https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/implement-service-plugins.md ## Article Content: # Implement Service Plugins Implement [service plugins](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/about-service-plugins.md) to extend the functionality of apps created by Wix on a site. > **Note:** You currently can't add the service plugin feature to a site when using Git Integration & CLI, or using the SDK. The process of implementing a service plugin has 5 steps: 1. [Creating a service plugin on a site](#step-1--create-a-service-plugin-on-a-site) 2. [Implementing and testing your custom code](#step-2--implement-your-service-plugin-with-custom-code) 3. [Testing the service plugin](#step-3--test-the-service-plugin) 4. [Deploying the service plugin](#step-4--deploy-the-extension) 5. [Removing an extension](#step-5--optional-remove-an-extension) The end result is a functional service plugin that extends a site's capabilities at specific points in app flows. For detailed instructions, see the tutorial for each [available service plugin](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/available-service-plugins.md). ## Step 1 | Create a service plugin on a site This step adds a service plugin to a site and creates the necessary folder structure. At the end of this step, you'll have a service plugin folder with template files ready for customization. To create a service plugin on a site: 1. If necessary, add the relevant app to a site, such as Wix Stores. 2. Go to the **Public & Backend** section of the **Code** sidebar. 3. Hover over **Service Plugins**, and click the **Add** icon to add the integration that you want. 4. Follow the prompts to add the plugin, and accept any terms and conditions that display. 5. Enter a name for your integration, and click **Add & Edit Code**. The name can't contain spaces or special characters. > **Note:** If you're using the Wix IDE, your plugin appears in the `/src/backend/service-plugin/` folder. If your service plugin doesn't appear, try refreshing both the editor and the Wix IDE. ## Step 2 | Implement your service plugin with custom code This step involves writing the custom logic for your service plugin in the generated template files. At the end of this step, you'll have functional code that implements your service plugin's logic. To implement your service plugin with custom code: 1. Locate the folder created in the previous step under **Service Plugins** in the **Public & Backend** section of the **Code** sidebar. The folder name is based on the plugin you chose and contains 2 files: `-config.js` and `.js`. 2. Find the default extension files and implement your custom code: - `-config.js`: The code in this file generally defines a method, `getConfig()`, that returns an object containing values used to configure your extension. Wix calls this method when you publish a site, and changes to the configuration don't take effect until you publish the site. - `.js`: The code in this file generally defines a method named after the purpose of the service plugin, such as `getShippingRates()` or `getFees()`. Wix calls this method to retrieve the data provided by the service plugin. For guidelines for writing your code, see the tutorial for each [available service plugin](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/about-service-plugins.md). > **Note:** We recommend you use the standard export syntax contained in the code files when they're created. If you wish to use a different export syntax, for information about supported formats, see [Module Export Syntax](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/java-script-velo/module-export-syntax.md). ## Step 3 | Test the service plugin Before deploying your service plugin, test it thoroughly to ensure it works correctly and handles various scenarios. Testing prevents production issues and validates your implementation. At the end of this step, you'll have verified that your service plugin functions as expected and handles edge cases properly. To test your service plugin: 1. **Start with functional testing**: Test your service plugin methods directly in the code editor using [functional testing](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/testing-monitoring/functional-testing/test-backend-functions-with-functional-testing.md). This lets you verify your logic without publishing your site. 2. **Add logging for debugging**: Include `console.log()` statements in your service plugin code to track execution flow and identify issues. After publishing, view these logs in [Wix Logs](https://dev.wix.com/docs/develop-websites/articles/workspace-tools/developer-tools/logs/about-logs.md). 3. **Validate method responses**: Verify that your service plugin methods return properly formatted responses matching the expected schema for your specific service plugin type. 4. **Test edge cases and error handling**: Ensure your code properly handles: - Invalid or missing input parameters - Network timeouts or failures (for external API calls) - Empty or null data scenarios - Large data sets or high-volume requests 5. **Verify configuration (if applicable)**: If your service plugin uses a config file, test that the `getConfig()` method returns valid configuration data. 6. **Test on a test site before production**: After publishing your site once, test service plugin changes on a [test site](https://support.wix.com/en/article/about-test-sites) before deploying to production. Note: You must publish your production site at least once after implementing the service plugin for it to work on test sites. ## Step 4 | Deploy the extension This step publishes your service plugin to make it active on a site. At the end of this step, your service plugin is live and functional. After your code files are ready, publish the site to deploy the service plugin extension. ## Step 5 | (Optional) Remove an extension This optional step removes a service plugin from a site if you no longer need it. At the end of this step, the service plugin is completely removed from a site. To remove an extension: 1. In the **Public & Backend** section of the **Code** sidebar, under **Service Plugins**, hover over the extension's folder and click the **More Actions** icon. 2. Click **Delete**. ## See also - [About Service Plugins](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/about-service-plugins.md) - [Available Service Plugins](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/service-plugins-formerly-spis/available-service-plugins.md) - [Understanding the difference between service plugins and APIs](https://medium.com/wix-engineering/let-others-solve-your-problems-change-your-mindset-from-apis-to-spis-781afa48574f) - [Service plugins reference documentation](https://www.wix.com/velo/reference/spis/getting-started)