Class · extends AbstractModel
A payment transaction.
A Transaction tracks a payment or refund made to a Client via a specific Invoice.
If the Transaction is a payment by a client toward an invoice, the value of the transaction will be stored in "amountIn."
If the Transaction is a payment by the operator of this WHMCS install to a Client by way of a Refund, the value of the transaction is stored in "amountOut."
ModelRelationBillingNote
| Type | Name | Description |
|---|---|---|
| `` | $timestamps |
public function client()A transaction can belong to a client.
Returns \Illuminate\Database\Eloquent\Relations\BelongsTo
public function invoice()A transaction can belong to an invoice.
Returns \Illuminate\Database\Eloquent\Relations\BelongsTo
public function refunds(): HasManypublic function originalTransaction(): BelongsTopublic function scopeLookup($query, $gateway, $transactionId)Perform a transaction lookup for a given gateway and transaction ID.
Parameters
| Type | Name | Description |
|---|---|---|
\Illuminate\Database\Eloquent\Builder | $query | |
string | $gateway | |
string | $transactionId |
Returns \Illuminate\Database\Eloquent\Builder
public function scopeNotBillingNotes($query)Parameters
| Type | Name | Description |
|---|---|---|
\Illuminate\Database\Eloquent\Builder | $query |
Returns \Illuminate\Database\Eloquent\Builder
public function gateway(): ?GatewayLoad the transaction's gateway module, if known to the transaction.
Returns Gateway\|null
public function gatewaySafe(): ?GatewayLoad the transaction's gateway module in a fail-silent manner.
Returns Gateway\|null
public function gatewaySupports(string $feature): boolDetermine if this transaction's gateway supports the requested feature. False will be returned for a failing or inactive gateway.
Parameters
| Type | Name | Description |
|---|---|---|
string | $feature | The feature to check for |
Returns bool
public function gatewayCallIfSupports($default, string $feature, array $params = [])Call and return the result of the specified gateway feature of this transaction's gateway, if the gateway and the feature is available; otherwise return the $default value.
Parameters
| Type | Name | Description |
|---|---|---|
mixed | $default | The value to return if the gateway or feature is not available. |
string | $feature | The gateway's feature to call. |
array | $params | The parameters required by the gateway feature. |
Returns mixed
public function getFormattedTransactionIdAttribute()Retrieve the transaction after formatting.
Returns string\|null
public function isBillingNoteReference(): boolpublic function isCreditNoteReference(): boolpublic function isDebitNoteReference(): boolpublic function isInvoiceReference(): boolpublic function getReferenceIdMarkup(): stringpublic function getTransactionIdMarkup(): stringReturns string — Return the transaction ID including possible markup for consistent decoration.
public function getBillingNoteLink(): stringpublic function getLink(): stringpublic static function isUnique($gateway, $transactionId): boolParameters
| Type | Name | Description |
|---|---|---|
string | $gateway | |
string | $transactionId |
Returns bool
public static function assertUnique($gateway, $transactionId): voidParameters
| Type | Name | Description |
|---|---|---|
string | $gateway | |
string | $transactionId |
public function getRefundsAttribute(): Collectionpublic function refundToClientCredit(?float $partialAmount = null, ?float $partialFees = null): ?Transactionpublic function getTypeAttribute(): LedgerType