Refund
extends Response
in package
Represents refund information for a SEP-24 transaction
This class encapsulates refund details for deposit or withdrawal transactions that have been partially or fully refunded. It includes the total refunded amount, associated fees, and a breakdown of individual refund payments.
Refunds may occur when a transaction fails, is cancelled, or when the anchor needs to return funds to the user. The refund object provides full transparency about the refund process including any fees charged for processing the refunds.
Tags
Table of Contents
Properties
- $amountFee : string
- $amountRefunded : string
- $payments : array<string|int, RefundPayment>
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : Refund
- Constructs a new instance of Refund by using the given data.
- getAmountFee() : string
- getAmountRefunded() : string
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getPayments() : array<string|int, RefundPayment>
- 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.
- setAmountFee() : void
- setAmountRefunded() : void
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- setPayments() : void
- loadFromJson() : void
- Loads the needed data from the given data array.
Properties
$amountFee
public
string
$amountFee
The total amount charged in fees for processing all refund payments, in units of amount_in_asset. The sum of all fee values in the payments object list should equal this value.
$amountRefunded
public
string
$amountRefunded
The total amount refunded to the user, in units of amount_in_asset. If a full refund was issued, this amount should match amount_in.
$payments
public
array<string|int, RefundPayment>
$payments
= array()
A list of objects containing information on the individual payments made back to the user as refunds.
$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 Refund by using the given data.
public
static fromJson(array<string|int, mixed> $json) : Refund
Parameters
- $json : array<string|int, mixed>
-
the data to construct the object from.
Return values
Refund —the object containing the parsed data.
getAmountFee()
public
getAmountFee() : string
Return values
string —The total amount charged in fees for processing all refund payments, in units of amount_in_asset. The sum of all fee values in the payments object list should equal this value.
getAmountRefunded()
public
getAmountRefunded() : string
Return values
string —The total amount refunded to the user, in units of amount_in_asset. If a full refund was issued, this amount should match amount_in.
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
getPayments()
public
getPayments() : array<string|int, RefundPayment>
Return values
array<string|int, RefundPayment> —A list of objects containing information on the individual payments made back to the user as refunds.
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|nullsetAmountFee()
public
setAmountFee(string $amountFee) : void
Parameters
- $amountFee : string
-
The total amount charged in fees for processing all refund payments, in units of amount_in_asset. The sum of all fee values in the payments object list should equal this value.
setAmountRefunded()
public
setAmountRefunded(string $amountRefunded) : void
Parameters
- $amountRefunded : string
-
The total amount refunded to the user, in units of amount_in_asset. If a full refund was issued, this amount should match amount_in.
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
setPayments()
public
setPayments(array<string|int, RefundPayment> $payments) : void
Parameters
- $payments : array<string|int, RefundPayment>
-
A list of objects containing information on the individual payments made back to the user as refunds.
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.