# WHMCS\Billing\Currency

`Class` · extends `AbstractModel` · implements `CurrencyInterface`

A currency.

## Constants

| Name | Description |
|  --- | --- |
| `DEFAULT_CURRENCY_ID` |  |


## Properties

| Type | Name | Description |
|  --- | --- | --- |
| `` | `$timestamps` |  |


## Methods

### boot

```php
public static function boot()
```

### scopeDefaultCurrency

```php
public function scopeDefaultCurrency($query)
```

### scopeCode

```php
public function scopeCode(Builder $query, string $code): Builder
```

### scopeDefaultSorting

```php
public function scopeDefaultSorting($query)
```

Show default currency first, and all other currencies sorted by currency code.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### validateCurrencyCode

```php
public static function validateCurrencyCode($currencyCode)
```

### factoryForClientArea

```php
public static function factoryForClientArea()
```

### convertTo

```php
public function convertTo(float $amount, Currency $currency): float
```

### convertBetween

```php
public static function convertBetween(CurrencyInterface $fromCurrency, float $amount, CurrencyInterface $toCurrency): float
```

Convert amount between currencies

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `CurrencyInterface` | `$fromCurrency` |  |
| `float` | `$amount` |  |
| `CurrencyInterface` | `$toCurrency` |  |


**Returns** `float`

### getCode

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

### setCode

```php
public function setCode(string $code): self
```

### getRate

```php
public function getRate(): float
```

### setRate

```php
public function setRate(float $rate): self
```

### nonFractionalCurrencyCodes

```php
public function nonFractionalCurrencyCodes(): array
```

**Returns** `string[]`

### isNonFractionalCurrency

```php
public function isNonFractionalCurrency(): bool
```

### valueInCurrencyPrecision

```php
public function valueInCurrencyPrecision(float $amount): float
```

Yield a value that reflects the Currency's support for fractional amounts.
This makes no attempt to return a value that match the actual fractional
precision for fraction supporting Currency.  For example in the
Currency is USD, and 1.666 is provided, 1.666 is returned.  If the
Currency is JPY for that same amount, 2.00 will be returned.

Note, even if this is a non-fractional currency, a float is returned for
consistency.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `float` | `$amount` |  |


**Returns** `float`