RefundPayment
extends Response
in package
Represents an individual refund payment within a SEP-24 transaction refund
This class encapsulates details of a single refund payment that is part of a larger transaction refund. When an anchor refunds a transaction, they may split the refund into multiple payments. Each payment is tracked separately with its own identifier, amount, and fee.
The payment ID can be either a Stellar transaction hash (for on-chain refunds) or an external payment reference (for off-chain refunds like bank transfers). This allows tracking of refunds regardless of the payment method used.
Tags
Table of Contents
Properties
- $amount : string
- $fee : string
- $id : string
- $idType : string
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : RefundPayment
- Constructs a new instance of RefundPayment by using the given data.
- getAmount() : string
- getFee() : string
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getId() : string
- getIdType() : string
- 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.
- setAmount() : void
- setFee() : void
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- setId() : void
- setIdType() : void
- loadFromJson() : void
- Loads the needed data from the given data array.
Properties
$amount
public
string
$amount
The amount sent back to the user for the payment identified by id, in units of amount_in_asset.
$fee
public
string
$fee
The amount charged as a fee for processing the refund, in units of amount_in_asset.
$id
public
string
$id
The payment ID that can be used to identify the refund payment. This is either a Stellar transaction hash or an off-chain payment identifier, such as a reference number provided to the user when the refund was initiated. This id is not guaranteed to be unique.
$idType
public
string
$idType
possible values: 'stellar' or 'external'.
$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()
Constructs a new instance of RefundPayment by using the given data.
public
static fromJson(array<string|int, mixed> $json) : RefundPayment
Parameters
- $json : array<string|int, mixed>
-
the data to construct the object from.
Return values
RefundPayment —the object containing the parsed data.
getAmount()
public
getAmount() : string
Return values
string —The amount sent back to the user for the payment identified by id, in units of amount_in_asset.
getFee()
public
getFee() : string
Return values
string —The amount charged as a fee for processing the refund, in units of amount_in_asset.
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()
public
getId() : string
Return values
string —The payment ID that can be used to identify the refund payment. This is either a Stellar transaction hash or an off-chain payment identifier, such as a reference number provided to the user when the refund was initiated. This id is not guaranteed to be unique.
getIdType()
public
getIdType() : string
Return values
string —possible values: 'stellar' or 'external'.
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
Return values
int|nullgetRateLimitRemaining()
Returns X-RateLimit-Remaining header from the response.
public
getRateLimitRemaining() : int|null
The number of remaining requests for the current window.
Tags
Return values
int|nullgetRateLimitReset()
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
public
getRateLimitReset() : int|null
Tags
Return values
int|nullsetAmount()
public
setAmount(string $amount) : void
Parameters
- $amount : string
-
The amount sent back to the user for the payment identified by id, in units of amount_in_asset.
setFee()
public
setFee(string $fee) : void
Parameters
- $fee : string
-
The amount charged as a fee for processing the refund, in units of amount_in_asset.
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
setId()
public
setId(string $id) : void
Parameters
- $id : string
-
The payment ID that can be used to identify the refund payment. This is either a Stellar transaction hash or an off-chain payment identifier, such as a reference number provided to the user when the refund was initiated. This id is not guaranteed to be unique.
setIdType()
public
setIdType(string $idType) : void
Parameters
- $idType : string
-
possible values: 'stellar' or 'external'.
loadFromJson()
Loads the needed data from the given data array.
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
the array containing the data to read from.