{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Service","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"service","__idx":0},"children":["Service"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following hooks are provided for Service related events."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cancellationrequest","__idx":1},"children":["CancellationRequest"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as a cancellation request is being created"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters","__idx":2},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["relid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the service being cancelled"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["reason"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response","__idx":3},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code","__idx":4},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('CancellationRequest', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"preserviceedit","__idx":5},"children":["PreServiceEdit"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as the service is being saved, before any changes have been made."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-1","__idx":6},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-1","__idx":7},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-1","__idx":8},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('PreServiceEdit', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"servicedelete","__idx":9},"children":["ServiceDelete"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the Service has been deleted."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-2","__idx":10},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An alias for $clientId maintained for backwards compatibility"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientId"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The client associated with the service"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The product service ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-2","__idx":11},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-2","__idx":12},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('ServiceDelete', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"serviceedit","__idx":13},"children":["ServiceEdit"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the Service has been edited. After the changes have been made."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-3","__idx":14},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-3","__idx":15},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-3","__idx":16},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('ServiceEdit', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"servicerecurringcompleted","__idx":17},"children":["ServiceRecurringCompleted"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the Recurring Cycles Limit is reached for a product."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-4","__idx":18},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["recurringinvoices"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The total count of invoices generated"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-4","__idx":19},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-4","__idx":20},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('ServiceRecurringCompleted', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]}]},"headings":[{"value":"Service","id":"service","depth":1},{"value":"CancellationRequest","id":"cancellationrequest","depth":2},{"value":"Parameters","id":"parameters","depth":4},{"value":"Response","id":"response","depth":4},{"value":"Example Code","id":"example-code","depth":4},{"value":"PreServiceEdit","id":"preserviceedit","depth":2},{"value":"Parameters","id":"parameters-1","depth":4},{"value":"Response","id":"response-1","depth":4},{"value":"Example Code","id":"example-code-1","depth":4},{"value":"ServiceDelete","id":"servicedelete","depth":2},{"value":"Parameters","id":"parameters-2","depth":4},{"value":"Response","id":"response-2","depth":4},{"value":"Example Code","id":"example-code-2","depth":4},{"value":"ServiceEdit","id":"serviceedit","depth":2},{"value":"Parameters","id":"parameters-3","depth":4},{"value":"Response","id":"response-3","depth":4},{"value":"Example Code","id":"example-code-3","depth":4},{"value":"ServiceRecurringCompleted","id":"servicerecurringcompleted","depth":2},{"value":"Parameters","id":"parameters-4","depth":4},{"value":"Response","id":"response-4","depth":4},{"value":"Example Code","id":"example-code-4","depth":4}],"frontmatter":{"title":"Service","seo":{"title":"Service"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/hooks-reference/service","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}