Skip to main content
POST
/
api
/
pay
/
{projectId}
/
chargeEvents
/
purchaseRefund
Get Purchase Refunds
curl --request POST \
  --url https://localhost:44371/api/pay/{projectId}/chargeEvents/purchaseRefund \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "startDate": "2023-11-07T05:31:56Z",
  "offset": 123,
  "limit": 5000,
  "isForAllProjectsInCompany": true
}
'
{
  "success": true,
  "code": 200,
  "errorMessage": null,
  "entries": []
}

Description

Queries refund history for the project. Purchase refunds are merchant-initiated returns of funds to customers, typically processed for product returns, cancellations, or dispute resolution. This endpoint enables reconciliation of refund transactions with accounting systems.

Input

  • Path Parameter: projectId (guid, required) — Project identifier for authentication.
  • Body: request (PurchaseRefundQueryRequest, required) — Query filters including:
    • startDate (datetime, optional) — Start date for refund date range.
    • endDate (datetime, optional) — End date for refund date range.
    • status (string, optional) — Refund status filter (Completed, Pending, Failed).
    • limit (int, optional) — Maximum number of records to return.
    • offset (int, optional) — Number of records to skip for pagination.

Output

Returns a PurchaseRefundQueryResponse containing refund entries or error information.

Example Request

POST /api/payment/{projectId}/charge-events/purchase-refund
Content-Type: application/json
X-API-Key: {your-api-key}

{
  "startDate": "2025-10-01",
  "endDate": "2025-10-31",
  "status": "Completed",
  "limit": 50,
  "offset": 0
}

Example Response

{
  "success": true,
  "code": 200,
  "errorMessage": null,
  "refunds": [
    {
      "refundId": "REF123456",
      "transactionId": "TX789012",
      "amount": 49.99,
      "status": "Completed",
      "refundDate": "2025-10-15T10:30:00Z",
      "reason": "Customer Return"
    }
  ],
  "totalCount": 1
}

Errors

  • 400 Bad Request — Invalid date range or query parameters.
  • 401 Unauthorized — Invalid or missing API key.
  • 403 Forbidden — Project does not have access to refund data.

Notes

  • Results are paginated; use limit and offset for large datasets.
  • Refunds typically take 3-10 business days to appear in customer accounts.
  • Empty results return success with an empty refunds array.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

projectId
string<guid>
required

The project identifier for authentication and authorization.

Body

application/json

The query request containing filters such as date range, refund status, and pagination parameters.

Represents the filters supported when querying CyberSource purchase refund data. Used by the charge event controller to request paged refund activity for a project.

startDate
string<date-time>
required

Start date for the refund query window. Only purchase refunds created on or after this timestamp are returned.

Minimum string length: 1
offset
integer<int32>
required

Offset into the result set used for pagination. Combine with Limit to iterate through multi-page responses.

limit
integer<int32>
required

Maximum number of refund records to return. Guarded to prevent excessive payload sizes when exporting data.

Required range: 1 <= x <= 10000
isForAllProjectsInCompany
boolean

Indicates whether the query should span every project in the company. When false, the authenticated project scope is applied automatically.

Response

Always returned. Check the success property in the response body to determine if the operation succeeded.

Standard response structure containing operation status and error information. Standard query response containing a collection of matching entities. Wraps purchase refund query results for API responses. Inherits paging metadata from BaseQueryResponse.

success
boolean

True if the operation completed successfully; false if an error occurred.

Example:

true

code
enum<string>

Result code indicating the outcome of the operation.

Available options:
Unknown,
Success,
BadRequest,
Unauthorized,
NotFound,
Error
Example:

200

errorMessage
string | null

Human-readable error message when an error occurs.

Example:

null

entries
object[] | null

Collection of entities matching the query criteria.

Example:
[]