Skip to main content
GET
/
api
/
refunds
/
:id
curl https://api.swiftpay.cx/api/refunds/ref_xyz789 \
  -H "Authorization: Bearer mp_live_your_api_key"
const refundId = "ref_xyz789";

const response = await fetch(
   `https://api.swiftpay.cx/api/refunds/${refundId}`,
   {
      headers: {
         Authorization: "Bearer mp_live_your_api_key",
      },
   }
);

const refund = await response.json();

switch (refund.data.status) {
   case "completed":
      console.log("Refund processed successfully");
      break;
   case "failed":
      console.log(`Refund failed: ${refund.data.failureReason}`);
      break;
   case "pending":
   case "processing":
      console.log("Refund still processing");
      break;
}
import requests

refund_id = 'ref_xyz789'

response = requests.get(
    f'https://api.swiftpay.cx/api/refunds/{refund_id}',
    headers={'Authorization': 'Bearer mp_live_your_api_key'}
)

refund = response.json()
print(f"Refund status: {refund['data']['status']}")
{
  "success": true,
  "data": {
    "id": "ref_xyz789",
    "checkoutSessionId": "sess_abc123",
    "amountInCents": 2999,
    "reason": "Customer requested refund",
    "status": "completed",
    "completedAt": "2024-01-15T10:35:00Z",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}
{
   "success": false,
   "error": {
      "type": "not_found",
      "message": "Refund not found",
      "requestId": "req_abc123"
   }
}

Get Refund

Retrieves the details of an existing refund.

Request

Authorization
string
required
Bearer token with your API key
id
string
required
The unique identifier of the refund (e.g., ref_xyz789)

Response

success
boolean
Whether the request was successful
data
object
curl https://api.swiftpay.cx/api/refunds/ref_xyz789 \
  -H "Authorization: Bearer mp_live_your_api_key"
const refundId = "ref_xyz789";

const response = await fetch(
   `https://api.swiftpay.cx/api/refunds/${refundId}`,
   {
      headers: {
         Authorization: "Bearer mp_live_your_api_key",
      },
   }
);

const refund = await response.json();

switch (refund.data.status) {
   case "completed":
      console.log("Refund processed successfully");
      break;
   case "failed":
      console.log(`Refund failed: ${refund.data.failureReason}`);
      break;
   case "pending":
   case "processing":
      console.log("Refund still processing");
      break;
}
import requests

refund_id = 'ref_xyz789'

response = requests.get(
    f'https://api.swiftpay.cx/api/refunds/{refund_id}',
    headers={'Authorization': 'Bearer mp_live_your_api_key'}
)

refund = response.json()
print(f"Refund status: {refund['data']['status']}")
{
  "success": true,
  "data": {
    "id": "ref_xyz789",
    "checkoutSessionId": "sess_abc123",
    "amountInCents": 2999,
    "reason": "Customer requested refund",
    "status": "completed",
    "completedAt": "2024-01-15T10:35:00Z",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}
{
   "success": false,
   "error": {
      "type": "not_found",
      "message": "Refund not found",
      "requestId": "req_abc123"
   }
}

Refund Statuses

StatusDescription
pendingRefund created, awaiting processing
processingRefund is being processed with payment provider
completedRefund successful, funds returned to customer
failedRefund failed, check failureReason
Use webhooks to get notified when refund status changes rather than polling this endpoint.