Stellar PHP SDK API Documentation

TransactionResponse extends Response

Represents a transaction that has been included in the Stellar ledger

This response contains comprehensive transaction details including the source account, fee information, operations, signatures, preconditions, and XDR representations of the transaction envelope, result, and metadata. Transactions can be regular transactions or fee-bump transactions wrapping inner transactions.

Key fields:

  • Transaction hash and ledger sequence
  • Source account and fee account details
  • Operation count and memo
  • Success status and result codes
  • XDR representations for envelope, result, and metadata
  • Signatures and preconditions
  • Fee-bump transaction details if applicable

Returned by Horizon endpoints:

  • GET /transactions/{transaction_hash} - Single transaction details
  • GET /transactions - List of transactions
  • GET /accounts/{account_id}/transactions - Account transactions
  • GET /ledgers/{sequence}/transactions - Ledger transactions
Tags
see
SubmitTransactionResponse

For transaction submission results

see
FeeBumpTransactionResponse

For fee-bump transaction details

see
InnerTransactionResponse

For inner transaction in fee-bump

see
https://developers.stellar.org

Stellar developer docs Horizon Transactions API

since
1.0.0

Table of Contents

Properties

$httpClient  : Client|null
$rateLimitLimit  : int|null
$rateLimitRemaining  : int|null
$rateLimitReset  : int|null

Methods

fromJson()  : TransactionResponse
Creates a TransactionResponse instance from JSON data
getCreatedAt()  : string
Gets the timestamp when this transaction was created
getEnvelopeXdr()  : XdrTransactionEnvelope
Gets the parsed transaction envelope XDR
getEnvelopeXdrBase64()  : string
Gets the base64-encoded transaction envelope XDR
getFeeAccount()  : string
Gets the account that paid the transaction fee
getFeeAccountMuxed()  : string|null
Gets the multiplexed fee account if applicable
getFeeAccountMuxedId()  : string|null
Gets the multiplexed fee account ID if applicable
getFeeBumpTransactionResponse()  : FeeBumpTransactionResponse|null
Gets the fee-bump transaction details if this is a fee-bump transaction
getFeeCharged()  : string|null
Gets the actual fee charged for this transaction in stroops
getFeeMetaXdr()  : array<string|int, mixed>|null
Gets the parsed fee metadata XDR as ledger entry changes
getFeeMetaXdrBase64()  : string|null
Gets the base64-encoded fee metadata XDR
getHash()  : string
Gets the transaction hash
getHttpClient()  : Client|null
Gets the HTTP client used for pagination requests
getId()  : string
Gets the unique identifier for this transaction
getInnerTransactionResponse()  : InnerTransactionResponse|null
Gets the inner transaction details if this is a fee-bump transaction
getLedger()  : int
Gets the ledger sequence number where this transaction was included
getLinks()  : TransactionLinksResponse
Gets the hypermedia links to related resources
getMaxFee()  : string|null
Gets the maximum fee the submitter was willing to pay in stroops
getMemo()  : Memo
Gets the memo attached to this transaction
getOperationCount()  : int
Gets the number of operations in this transaction
getPagingToken()  : string
Gets the paging token for this transaction in list results
getPreconditions()  : TransactionPreconditionsResponse|null
Gets the transaction preconditions if any were set
getRateLimitLimit()  : int|null
Returns X-RateLimit-Limit header from the response.
getRateLimitRemaining()  : int|null
Returns X-RateLimit-Remaining header from the response.
getRateLimitReset()  : int|null
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
getResultMetaXdr()  : XdrTransactionMeta|null
Gets the parsed transaction metadata XDR
getResultMetaXdrBase64()  : string|null
Gets the base64-encoded transaction metadata XDR
getResultXdr()  : XdrTransactionResult
Gets the parsed transaction result XDR
getResultXdrBase64()  : string
Gets the base64-encoded transaction result XDR
getSignatures()  : TransactionSignaturesResponse
Gets the signatures attached to this transaction
getSourceAccount()  : string
Gets the source account for this transaction
getSourceAccountMuxed()  : string|null
Gets the multiplexed source account if applicable
getSourceAccountMuxedId()  : string|null
Gets the multiplexed source account ID if applicable
getSourceAccountSequence()  : string
Gets the sequence number used by this transaction
isSuccessful()  : bool
Checks if the transaction was successful
setHeaders()  : void
Extracts and sets rate limiting information from HTTP response headers
setHttpClient()  : void
Sets the HTTP client for making follow-up requests
loadFromJson()  : void
Loads response data from a JSON array

Properties

$httpClient

protected Client|null $httpClient = null

$rateLimitLimit

protected int|null $rateLimitLimit = null

$rateLimitRemaining

protected int|null $rateLimitRemaining = null

$rateLimitReset

protected int|null $rateLimitReset = null

Methods

fromJson()

Creates a TransactionResponse instance from JSON data

public static fromJson(array<string|int, mixed> $json) : TransactionResponse
Parameters
$json : array<string|int, mixed>

The JSON array containing transaction data from Horizon

Return values
TransactionResponse

The parsed transaction response

getCreatedAt()

Gets the timestamp when this transaction was created

public getCreatedAt() : string
Return values
string

The creation time in ISO 8601 format

getEnvelopeXdrBase64()

Gets the base64-encoded transaction envelope XDR

public getEnvelopeXdrBase64() : string
Return values
string

The envelope XDR as a base64 string

getFeeAccount()

Gets the account that paid the transaction fee

public getFeeAccount() : string

For fee-bump transactions, this differs from the source account.

Return values
string

The fee account ID

getFeeAccountMuxed()

Gets the multiplexed fee account if applicable

public getFeeAccountMuxed() : string|null
Return values
string|null

The muxed fee account address, or null if not muxed

getFeeAccountMuxedId()

Gets the multiplexed fee account ID if applicable

public getFeeAccountMuxedId() : string|null
Return values
string|null

The muxed fee account ID, or null if not muxed

getFeeCharged()

Gets the actual fee charged for this transaction in stroops

public getFeeCharged() : string|null
Return values
string|null

The fee charged as a string, or null if not available

getFeeMetaXdr()

Gets the parsed fee metadata XDR as ledger entry changes

public getFeeMetaXdr() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

Array of XdrLedgerEntryChange objects, or null

getFeeMetaXdrBase64()

Gets the base64-encoded fee metadata XDR

public getFeeMetaXdrBase64() : string|null
Return values
string|null

The fee metadata XDR, or null if not available

getHash()

Gets the transaction hash

public getHash() : string
Return values
string

The 64-character hexadecimal transaction hash

getHttpClient()

Gets the HTTP client used for pagination requests

public getHttpClient() : Client|null
Return values
Client|null

The HTTP client instance, or null if not set

getId()

Gets the unique identifier for this transaction

public getId() : string
Return values
string

The transaction ID

getLedger()

Gets the ledger sequence number where this transaction was included

public getLedger() : int
Return values
int

The ledger sequence number

getMaxFee()

Gets the maximum fee the submitter was willing to pay in stroops

public getMaxFee() : string|null
Return values
string|null

The max fee as a string, or null if not available

getOperationCount()

Gets the number of operations in this transaction

public getOperationCount() : int
Return values
int

The operation count

getPagingToken()

Gets the paging token for this transaction in list results

public getPagingToken() : string
Return values
string

The paging token used for cursor-based pagination

getRateLimitLimit()

Returns X-RateLimit-Limit header from the response.

public getRateLimitLimit() : int|null

This number represents the he maximum number of requests that the current client can make in one hour.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitRemaining()

Returns X-RateLimit-Remaining header from the response.

public getRateLimitRemaining() : int|null

The number of remaining requests for the current window.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitReset()

Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.

public getRateLimitReset() : int|null
Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getResultMetaXdrBase64()

Gets the base64-encoded transaction metadata XDR

public getResultMetaXdrBase64() : string|null
Return values
string|null

The metadata XDR as a base64 string, or null

getResultXdrBase64()

Gets the base64-encoded transaction result XDR

public getResultXdrBase64() : string
Return values
string

The result XDR as a base64 string

getSourceAccount()

Gets the source account for this transaction

public getSourceAccount() : string
Return values
string

The source account ID

getSourceAccountMuxed()

Gets the multiplexed source account if applicable

public getSourceAccountMuxed() : string|null
Return values
string|null

The muxed source account address, or null if not muxed

getSourceAccountMuxedId()

Gets the multiplexed source account ID if applicable

public getSourceAccountMuxedId() : string|null
Return values
string|null

The muxed account ID, or null if not muxed

getSourceAccountSequence()

Gets the sequence number used by this transaction

public getSourceAccountSequence() : string
Return values
string

The source account sequence number

isSuccessful()

Checks if the transaction was successful

public isSuccessful() : bool
Return values
bool

True if all operations succeeded, false if any failed

setHeaders()

Extracts and sets rate limiting information from HTTP response headers

public setHeaders(array<string|int, mixed> $headers) : void

This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.

Parameters
$headers : array<string|int, mixed>

Associative array of HTTP headers from the response

setHttpClient()

Sets the HTTP client for making follow-up requests

public setHttpClient([Client|null $httpClient = null ]) : void

Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.

Parameters
$httpClient : Client|null = null

The Guzzle HTTP client to use for pagination

loadFromJson()

Loads response data from a JSON array

protected loadFromJson(array<string|int, mixed> $json) : void

This method is used internally to populate response objects from parsed JSON. Subclasses override this to extract their specific data fields.

Parameters
$json : array<string|int, mixed>

Associative array of parsed JSON data


        
On this page

Search results