# WHMCS\Service\Addon

`Class` · extends `AbstractModel` · implements `ServiceInterface`, `InvoicingServiceInterface`, `SubscriptionAwareInterface`, `ServicePricingInterface`

Service addons

Please note that "Service Addons" are completely separate from "WHMCS Addons,"
which add functionality to WHMCS.

A service Addon allows the operator of WHMCS to provide additional services which
are conditional to the purchase of a parent Service, such as additional disk space
or other similar services.

This object is an instance of a service addon, including the fees and cycles
configured in the Order which purchased this addon.

## Traits

- `DomainTraits`
- `ProvisioningTraits`
- `SubscriptionAwareTrait`


## Methods

### getServiceActual

```php
public function getServiceActual(): Service
```

### getServiceSurrogate

```php
public function getServiceSurrogate(): Service
```

### hasServiceSurrogate

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

### getServiceClient

```php
public function getServiceClient(): Client
```

### getServiceProperties

```php
public function getServiceProperties(): Properties
```

### boot

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

### scopeUserId

```php
public function scopeUserId(Builder $query, $userId)
```

**Parameters**

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


**Returns** `Builder`

### scopeOfService

```php
public function scopeOfService(Builder $query, $serviceId)
```

**Parameters**

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


**Returns** `Builder`

### scopeActive

```php
public function scopeActive(Builder $query)
```

**Parameters**

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


**Returns** `Builder`

### scopeMarketConnect

```php
public function scopeMarketConnect(Builder $query)
```

Filter for only MarketConnect addon services.

**Parameters**

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


**Returns** `Builder`

### scopeIsConsideredActive

```php
public function scopeIsConsideredActive(Builder $query)
```

**Parameters**

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


**Returns** `Builder`

### scopeIsNotRecurring

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

**Parameters**

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


**Returns** `Builder`

### service

```php
public function service()
```

Each addon belongs to one service.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsTo`

### productAddon

```php
public function productAddon()
```

Each addon belongs to a single product addon.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsTo`

### client

```php
public function client()
```

Each addon belongs to one client.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsTo`

### customFieldValues

```php
public function customFieldValues()
```

**Returns** `HasMany\|CustomFieldValue`

### getNonTerminalStatuses

```php
public static function getNonTerminalStatuses(): array
```

Status values representative of an entry that has further status values it could transition to.

**Returns** `string[]` — Array of Statuses as strings

### order

```php
public function order()
```

An addon belongs to a single order.

**Returns** `BelongsTo`

### paymentGateway

```php
public function paymentGateway()
```

Each addon has many payment gateway records.

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany`

### getServicePropertiesAttribute

```php
public function getServicePropertiesAttribute()
```

**Returns** `Properties`

### ssl

```php
public function ssl()
```

Each addon could have many ssl records.

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany`

### invoices

```php
public function invoices(): BelongsToMany
```

### canBeUpgraded

```php
public function canBeUpgraded()
```

Determine if addon can be upgraded.

**Returns** `bool`

### isService

```php
public function isService()
```

Is this entity a service?

**Returns** `bool`

### isAddon

```php
public function isAddon()
```

Is this entity an addon?

**Returns** `bool`

### serverModel

```php
public function serverModel()
```

**Returns** `\Illuminate\Database\Eloquent\Relations\HasOne`

### failedActions

```php
public function failedActions()
```

**Returns** `HasMany`

### moduleConfiguration

```php
public function moduleConfiguration()
```

**Returns** `HasMany`

### legacyProvision

```php
public function legacyProvision()
```

Run provision action in legacy mode.

Legacy mode returns 'success' on success and an error message string on failure.

**Returns** `string`

### isProrated

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

### isRecurring

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

**Returns** `bool`

### isFree

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

**Returns** `bool`

### getLink

```php
public function getLink()
```

### recalculateRecurringPrice

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

### getProvisioningTypeAttribute

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

**Returns** `string`

### getFirstPaymentAmount

```php
public function getFirstPaymentAmount(): FormatterPrice
```

### getRecurringAmount

```php
public function getRecurringAmount(): FormatterPrice
```

### getBillingCycle

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

### getPaymentGateway

```php
public function getPaymentGateway(): Gateway
```

### getNextDueDate

```php
public function getNextDueDate(): ?Carbon
```

### getPromotions

```php
public function getPromotions(): SupportCollection
```

Service's addon does not support promotion at this time but need to return empty collection
to meet interface's requirements

**Returns** `SupportCollection`

### getServiceProduct

```php
public function getServiceProduct(): ?AddonInterface
```

Returns the associated predefined Addon or an AdHoc addon if the
product addon is null

**Returns** `AddonInterface\|null`

### getInvoicingServiceItemType

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

### getInvoicingServiceFirstPaymentAmount

```php
public function getInvoicingServiceFirstPaymentAmount(): FormatterPrice
```

### getInvoicingServiceRecurringAmount

```php
public function getInvoicingServiceRecurringAmount(): FormatterPrice
```

### isServiceMetricUsage

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

Addon does not support Usage billing at this time

**Returns** `bool`