{"templateId":"markdown","versions":[{"version":"9.0","label":"9.0","link":"/classes/whmcs/module/gateway/balanceinterface","default":true,"active":true,"folderId":"9d7dc099"},{"version":"8.13","label":"8.13","link":"/classes/8.13/whmcs/module/gateway/balanceinterface","default":false,"active":false,"folderId":"9d7dc099"}],"sharedDataIds":{"sidebar":"sidebar-classes/@8.13/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"WHMCS\\Module\\Gateway\\BalanceInterface","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":"whmcsmodulegatewaybalanceinterface","__idx":0},"children":["WHMCS\\Module\\Gateway\\BalanceInterface"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Interface"]}," · implements ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["JsonSerializable"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["BalanceInterface is used as part of the WHMCS\\Module\\Gateway\\Balance object to ensure"," ","that all required methods are present for output."," ","Utilise the factory method to initialise the BalanceInterface object that will be added to"," ","a BalanceCollection object in your custom gateway module."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"methods","__idx":1},"children":["Methods"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getamount","__idx":2},"children":["getAmount"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public function getAmount(): Price\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the amount for the BalanceInterface object as a WHMCS\\View\\Formatter\\Price object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Price"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getcolor","__idx":3},"children":["getColor"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public function getColor(): string\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the color for the BalanceInterface object."," ","e.g. #5dc560"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getcurrencycode","__idx":4},"children":["getCurrencyCode"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public function getCurrencyCode(): string\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the currency code for the BalanceInterface object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getcurrencyobject","__idx":5},"children":["getCurrencyObject"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public function getCurrencyObject(): ?Currency\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the WHMCS\\Billing\\Currency object for the BalanceInterface object using the currencyCode"," ","as the query term. Will return null for an unknown currency."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Currency\\|null"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getlabel","__idx":6},"children":["getLabel"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public function getLabel(): string\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the label for the BalanceInterface item. This should be the translated value."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"factory","__idx":7},"children":["factory"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"public static function factory(float $amount, string $currencyCode, ?string $label = null, ?string $color = null): BalanceInterface\n","lang":"php"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initialise the BalanceInterface object providing the data that will be used on output."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"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":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["float"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$amount"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount for the BalanceInterface object. e.g. 10.00"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$currencyCode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The currency code for the BalanceInterface object. e.g. USD"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string|null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$label"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The language string to be used for the label. e.g. status.available"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string|null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$color"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The color to be used for the BalanceInterface object output. e.g. #5dc560"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Returns"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BalanceInterface"]}]}]},"headings":[{"value":"WHMCS\\Module\\Gateway\\BalanceInterface","id":"whmcsmodulegatewaybalanceinterface","depth":1},{"value":"Methods","id":"methods","depth":2},{"value":"getAmount","id":"getamount","depth":3},{"value":"getColor","id":"getcolor","depth":3},{"value":"getCurrencyCode","id":"getcurrencycode","depth":3},{"value":"getCurrencyObject","id":"getcurrencyobject","depth":3},{"value":"getLabel","id":"getlabel","depth":3},{"value":"factory","id":"factory","depth":3}],"frontmatter":{"title":"WHMCS\\Module\\Gateway\\BalanceInterface","seo":{"title":"WHMCS\\Module\\Gateway\\BalanceInterface"}},"lastModified":"2026-08-05T14:37:16.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/classes/whmcs/module/gateway/balanceinterface","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}