# WHMCS\Billing\Payment\Transaction\Information

`Class` · implements `Arrayable`

The information class is used to provide additional
data for a transaction from a gateway module.

All set methods can be chained and are optional.
We recommend that the transaction id, amount and currency
be set as a minimum.

## Methods

### setTransactionId

```php
public function setTransactionId(string $transactionId): self
```

Set the transaction id.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$transactionId` |  |


**Returns** `self`

### setAmount

```php
public function setAmount(float $amount, ?CurrencyInterface $currency = null): self
```

The amount and currency of the transaction as processed.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `float` | `$amount` |  |
| `CurrencyInterface|null` | `$currency` |  |


**Returns** `self`

### setFee

```php
public function setFee(float $fee, ?CurrencyInterface $currency = null): self
```

A sum of all fees charged against the transaction. The fee can be charged in
either the amount or received-amount currency.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `float` | `$fee` |  |
| `CurrencyInterface|null` | `$currency` |  |


**Returns** `$this`

### setMerchantAmount

```php
public function setMerchantAmount(float $amount, ?CurrencyInterface $currency = null): self
```

The amount and currency credited/debited against the merchant's gateway account.
This should differ from the transaction amount due to including the deduction
of fees and any necessary currency exchange between the transaction currency
and the merchant's gateway account currency.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `float` | `$amount` |  |
| `CurrencyInterface|null` | `$currency` |  |


**Returns** `self`

### setType

```php
public function setType(string $type): self
```

Set the type of the transaction according to the gateway.
Examples include: `charge`, `refund`.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$type` |  |


**Returns** `self`

### setCurrency

```php
public function setCurrency(CurrencyInterface $currency): self
```

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `CurrencyInterface` | `$currency` |  |


**Returns** `self`

### setFeeCurrency

```php
public function setFeeCurrency(CurrencyInterface $currency): self
```

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `CurrencyInterface` | `$currency` |  |


**Returns** `$this`

### setMerchantCurrency

```php
public function setMerchantCurrency(CurrencyInterface $currency): self
```

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `CurrencyInterface` | `$currency` |  |


**Returns** `$this`

### setDescription

```php
public function setDescription(string $description): self
```

Set a description for the transaction.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$description` |  |


**Returns** `self`

### setStatus

```php
public function setStatus(string $status): self
```

Set the transaction status.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$status` |  |


**Returns** `self`

### setExchangeRate

```php
public function setExchangeRate(float $exchangeRate): Information
```

Set the exchange rate for the transaction.

**Parameters**

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


**Returns** `Information`

### setCreated

```php
public function setCreated(Carbon $created): self
```

Set the date that the transaction was created.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Carbon` | `$created` |  |


**Returns** `self`

### setAvailableOn

```php
public function setAvailableOn(Carbon $availableOn): self
```

Set the date that the transaction will be available on.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Carbon` | `$availableOn` |  |


**Returns** `self`

### setAdditionalData

```php
public function setAdditionalData(array $additionalData): self
```

Set an array of additional data to be displayed on the
transaction information modal.

**Parameters**

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


**Returns** `self`

### setAdditionalDatum

```php
public function setAdditionalDatum(string $key, $value): self
```

Set a single additional datum to be displayed on the information modal.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$key` |  |
| `string|float` | `$value` |  |


**Returns** `self`

### toArray

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

Obtain all the data provided to the Information class in an array
format. Used in the product to populate the modal data.

**Returns** `array`

### addRelatedTransaction

```php
public function addRelatedTransaction(string $identifier, string $type = ''): self
```

Include additional transaction identifiers that related to the 'primary'
transaction identifier.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$identifier` |  |
| `string` | `$type` | the same kinds of values provided to setType() |


**Returns** `$this`

### getRelatedTransactions

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

**Returns** `object{identifier:` — string, type: string}[]