{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Currency Formatting","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":"currency-formatting","__idx":0},"children":["Currency Formatting"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following helper functions are provided for formatting currency values."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"get-clients-currency","__idx":1},"children":["Get Clients Currency"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * Get clients currency\n *\n * Required before making a call to formatCurrency\n *\n * @param int $clientId The database ID number of the client to retrieve the currency information from\n *\n * @return array\n */\n$currencyData = getCurrency($clientId);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"format-currency","__idx":2},"children":["Format Currency"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * Format currency\n *\n * @param float $amount\n * @param int   $currencyId\n *\n * @return \\WHMCS\\View\\Formatter\\Price\n */\n$price = formatCurrency($amount, $currencyData['id']);\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$price"]}," value returned will be an object. The default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__toString"]}," response format is a fully formatted price output including prefix and suffix."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See https://classdocs.whmcs.com/8.1/WHMCS/View/Formatter/Price.html for more information."]}]},"headings":[{"value":"Currency Formatting","id":"currency-formatting","depth":1},{"value":"Get Clients Currency","id":"get-clients-currency","depth":2},{"value":"Format Currency","id":"format-currency","depth":2}],"frontmatter":{"title":"Currency Formatting","seo":{"title":"Currency Formatting"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/advanced/currency-formatting","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}