# WHMCS\Product\Pricing\Price

`Class`

Price per cycle formatting helper

## Methods

### __construct

```php
public function __construct($price)
```

Initialise price object

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `array` | `$price` |  |


**Returns** `self`

### cycle

```php
public function cycle()
```

Return billing cycle

**Returns** `string`

### isFree

```php
public function isFree()
```

Is the billing cycle one time?

**Returns** `bool`

### isOneTime

```php
public function isOneTime()
```

Is the billing cycle one time?

**Returns** `bool`

### isRecurring

```php
public function isRecurring()
```

Is the billing cycle recurring?

**Returns** `bool`

### setup

```php
public function setup()
```

Return setup fees

**Returns** `\WHMCS\View\Formatter\Price\|null`

### price

```php
public function price()
```

Return price

**Returns** `\WHMCS\View\Formatter\Price`

### breakdown

```php
public function breakdown()
```

Return breakdown pricing info

**Returns** `array`

### toPrefixedString

```php
public function toPrefixedString()
```

Format price as a prefixed currency string

**Returns** `string`

### toSuffixedString

```php
public function toSuffixedString()
```

Format price as a suffixed string

**Returns** `string`

### toFullString

```php
public function toFullString()
```

Format price as a full currency string (prefix, amount and suffix)

**Returns** `string`

### getShortCycle

```php
public function getShortCycle()
```

Get short two-letter version of billing cycle

**Returns** `string`

### isYearly

```php
public function isYearly()
```

Returns true if the price is a yearly price

**Returns** `bool`

### isMonthly

```php
public function isMonthly()
```

Returns true if the price is a monthly price

**Returns** `bool`

### cycleInYears

```php
public function cycleInYears()
```

Get billing cycle in year(s)

**Returns** `string`

### yearlyPrice

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

Get per year price

### cycleInMonths

```php
public function cycleInMonths()
```

Get billing cycle in month(s)

**Returns** `string`

### monthlyPrice

```php
public function monthlyPrice()
```

Get per month price

**Returns** `string`

### oneTimePrice

```php
public function oneTimePrice()
```

Get one time price

**Returns** `string`

### breakdownPrice

```php
public function breakdownPrice()
```

Get best available breakdown price

**Returns** `string`

### breakdownPriceNumeric

```php
public function breakdownPriceNumeric()
```

Get best available breakdown price as a number

**Returns** `string`

### calculatePercentageDifference

```php
public function calculatePercentageDifference($price, $decimalPlaces = 0)
```

Calculate percentage difference between two prices.

Will return the percentage discount from a given higher amount
compared with the monthly amount from the current instantiated object.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `float` | `$price` | Higher amount to be calculated against |
| `int` | `$decimalPlaces` | Number of decimals. Default 0. |


**Returns** `float`