# WHMCS\Module\Gateway\BalanceInterface

`Interface` · implements `JsonSerializable`

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.

## Methods

### getAmount

```php
public function getAmount(): Price
```

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

**Returns** `Price`

### getColor

```php
public function getColor(): string
```

Get the color for the BalanceInterface object.
e.g. #5dc560

**Returns** `string`

### getCurrencyCode

```php
public function getCurrencyCode(): string
```

Get the currency code for the BalanceInterface object.

**Returns** `string`

### getCurrencyObject

```php
public function getCurrencyObject(): ?Currency
```

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

**Returns** `Currency\|null`

### getLabel

```php
public function getLabel(): string
```

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

**Returns** `string`

### factory

```php
public static function factory(float $amount, string $currencyCode, ?string $label = null, ?string $color = null): BalanceInterface
```

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

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `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 |


**Returns** `BalanceInterface`