# Refunds

# List refunds

Returns a list of refunds with most recently created refunds first. Refunds are filtered based on the parameters specified. Pagination is supported and number of refunds per page can be specified using the arguments - page and limit.

Endpoint GET /refunds

Query parameters

Parameter Description Example
chargeId Charge ID
status Refund status from (#refund-status)
startDate Earliest refund creation time in UTC 2021-12-14T02:10:00
endDate Latest refund creation time in UTC 2021-12-14T02:10:00
customerCurrency Customer's currency SGD
customerEmail Customer's email customer@gmail.com
customerPhone Customer's phone number with '+' stripped. Used for filtering charges only if the customerEmail parameter is not specified. 6512345678901
page Page number of results. The value is 1 by default. 2
limit Limit on the number of objects returned. The value is 10 by default and can range from 1 to 50 25

Request example

curl
-H "Content-Type: application/json"
-u {API_KEY}:{API_SECRET}
"https://api.xanpay.com/refunds?chargeId=609c80f6a5b44800116d7c16 "

Response example TBD: Add response example, after development

# Get a refund

Returns refund details including a refund object.

Endpoint GET /refunds/{id}

Response Refund object

Request example

curl
-H "Content-Type: application/json"
-u {API_KEY}:{API_SECRET}
"https://api.xanpay.com/refunds/6f7d1cc4d56bef00123b068f"

Response example TBD: Add response example, after development

# Create a refund

Returns a new refund created for the charge specified in the body. This endpoint could result in an error in the following situations - permissions not available, charge not found, refund amount exceeds available charge amount.

Endpoint POST /refunds

Payload attributes

Parameter Required Description
chargeId Required Charge ID
customerAmount Required Amount to be refunded in customer's currency

Response Refund object

# Refund object

Below you can find description for each refund's field.

Attributes

Parameter Description
id Unique refund ID
chargeId Charge ID
customer Customer object including email and phone
method Customer's payment method
customerAmount Amount to be refunded in customer's currency
customerCurrency Customer's currency, depends on the method
status Current refund status
createdAt Timestamp of when the refund was created
updatedAt Timestamp of when the refund was updated

# Refund status

Status Description
initiated Waiting for the customer to enter refund payment details
processing Customer has confirmed details, refund is being processed
completed Funds have been transferred to customer