Skip to content
Last updated

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

public function setTransactionId(string $transactionId): self

Set the transaction id.

Parameters

TypeNameDescription
string$transactionId

Returns self

setAmount

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

The amount and currency of the transaction as processed.

Parameters

TypeNameDescription
float$amount
CurrencyInterface|null$currency

Returns self

setFee

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

TypeNameDescription
float$fee
CurrencyInterface|null$currency

Returns $this

setMerchantAmount

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

TypeNameDescription
float$amount
CurrencyInterface|null$currency

Returns self

setType

public function setType(string $type): self

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

Parameters

TypeNameDescription
string$type

Returns self

setCurrency

public function setCurrency(CurrencyInterface $currency): self

Parameters

TypeNameDescription
CurrencyInterface$currency

Returns self

setFeeCurrency

public function setFeeCurrency(CurrencyInterface $currency): self

Parameters

TypeNameDescription
CurrencyInterface$currency

Returns $this

setMerchantCurrency

public function setMerchantCurrency(CurrencyInterface $currency): self

Parameters

TypeNameDescription
CurrencyInterface$currency

Returns $this

setDescription

public function setDescription(string $description): self

Set a description for the transaction.

Parameters

TypeNameDescription
string$description

Returns self

setStatus

public function setStatus(string $status): self

Set the transaction status.

Parameters

TypeNameDescription
string$status

Returns self

setExchangeRate

public function setExchangeRate(float $exchangeRate): Information

Set the exchange rate for the transaction.

Parameters

TypeNameDescription
float$exchangeRate

Returns Information

setCreated

public function setCreated(Carbon $created): self

Set the date that the transaction was created.

Parameters

TypeNameDescription
Carbon$created

Returns self

setAvailableOn

public function setAvailableOn(Carbon $availableOn): self

Set the date that the transaction will be available on.

Parameters

TypeNameDescription
Carbon$availableOn

Returns self

setAdditionalData

public function setAdditionalData(array $additionalData): self

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

Parameters

TypeNameDescription
array$additionalData

Returns self

setAdditionalDatum

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

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

Parameters

TypeNameDescription
string$key
string|float$value

Returns self

toArray

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

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

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

Parameters

TypeNameDescription
string$identifier
string$typethe same kinds of values provided to setType()

Returns $this

getRelatedTransactions

public function getRelatedTransactions(): array

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