{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Service Properties","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-properties","__idx":0},"children":["Service Properties"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"notice info"},"children":["This page describes a feature available in version 7.2 and above. WHMCS 7.2 introduced the ability to associate product addons with provisioning modules."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Many provisioning modules require you to store additional information relating to a product. To make it easier to work with this extra data and to aid module developers, WHMCS 7.2 introduced the concept of Service Properties."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A service property is a key/value pair relating to a given instance of a product or addon. Stored in custom fields, service properties allow module developers to interact with these fields in a simple programmatic way that is consistent for both products and addons."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"using-service-properties","__idx":1},"children":["Using Service Properties ",{"$$mdtype":"Tag","name":"a","attributes":{"id":"using-service-properties"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A model instance (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.whmcs.com/advanced/db-interaction/","title":"Interacting with the Database"},"children":["Interacting with the Database"]}," ) that represents the target service or addon is passed to all module function invocations as part of the module parameters."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * @param array $params\n *\n * @return string\n */\nfunction samplemodule_CreateAccount(array $params)\n{\n    try {\n        // Perform actions to provision service and receive back an order number\n        $orderNumber = '12345';\n\n        // Save order number to Service Properties\n        $params['model']->serviceProperties->save(['Order Number' => $orderNumber]);\n\n        return 'success';\n    } catch (\\Exception $e) {\n        return $e->getMessage();\n    }\n}\n\nfunction samplemodule_SuspendAccount(array $params)\n{\n\ttry {\n\t\t// Utilise Service Properties to retrieve the Order Number\n\t\t$orderNumber = $params['model']->serviceProperties->get('Order Number');\n\n\t\t// Perform actions using order number here\n\n\t\treturn 'success';\n        } catch (\\Exception $e) {\n            return $e->getMessage();\n        }\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The 'save' method will look up a custom field with the given name. If no existing field is found, a new custom field will be created to store the value."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"supported-fields","__idx":2},"children":["Supported Fields ",{"$$mdtype":"Tag","name":"a","attributes":{"id":"supported-fields"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using Service Properties against a service (for example, a directly-created product rather than an addon), sometimes a dedicated core field will be used instead of a custom field. This occurs for the following field names:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Username"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Password"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Domain"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["License Key"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Dedicated IP"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Disk Usage"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Disk Limit"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Bandwidth Usage"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Bandwidth Limit"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Last Update"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using these field names with an addon will create a custom field."]}]},"headings":[{"value":"Service Properties","id":"service-properties","depth":1},{"value":"Using Service Properties","id":"using-service-properties","depth":2},{"value":"Supported Fields","id":"supported-fields","depth":2}],"frontmatter":{"title":"Service Properties","seo":{"title":"Service Properties"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/provisioning-modules/service-properties","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}