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.

interface BalanceInterface implements JsonSerializable

Methods summary

Return Type Method Name Description
Price getAmount() Get the amount for the BalanceInterface object as a WHMCS\View\Formatter\Price object.
string getColor() Get the color for the BalanceInterface object.
string getCurrencyCode() Get the currency code for the BalanceInterface object.
Currency|null getCurrencyObject() Get the WHMCS\Billing\Currency object for the BalanceInterface object using the currencyCode as the query term. Will return null for an unknown currency.
string getLabel() Get the label for the BalanceInterface item. This should be the translated value.
static BalanceInterface factory(float $amount, string $currencyCode, string|null $label = null, string|null $color = null) Initialise the BalanceInterface object providing the data that will be used on output.

Details

Price getAmount ()

Get the amount for the BalanceInterface object as a WHMCS\View\Formatter\Price object.

Return Value

Price

string getColor ()

Get the color for the BalanceInterface object.

e.g. #5dc560

Return Value

string

string getCurrencyCode ()

Get the currency code for the BalanceInterface object.

Return Value

string

Currency|null getCurrencyObject ()

Get the WHMCS\Billing\Currency object for the BalanceInterface object using the currencyCode as the query term. Will return null for an unknown currency.

Return Value

Currency|null

string getLabel ()

Get the label for the BalanceInterface item. This should be the translated value.

Return Value

string

static BalanceInterface factory (float $amount, string $currencyCode, string|null $label = null, string|null $color = null)

Initialise the BalanceInterface object providing the data that will be used on output.

Parameters

float $amount The amount for the BalanceInterface object. e.g. 10.00
string $currencyCode The currency code for the BalanceInterface object. e.g. USD
string|null $label The language string to be used for the label. e.g. status.available
string|null $color The color to be used for the BalanceInterface object output. e.g. #5dc560

Return Value

BalanceInterface