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"
}
}
Refunds
Get Refund
Retrieve a specific refund by ID
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
Bearer token with your API key
The unique identifier of the refund (e.g.,
ref_xyz789)Response
Whether the request was successful
Show properties
Show properties
Unique refund identifier
Associated checkout session ID
Refund amount in cents
Refund reason if provided
Current status:
pending, processing, completed, failedReason for failure (if status is
failed)ISO 8601 completion timestamp (if completed)
ISO 8601 creation timestamp
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
| Status | Description |
|---|---|
pending | Refund created, awaiting processing |
processing | Refund is being processed with payment provider |
completed | Refund successful, funds returned to customer |
failed | Refund failed, check failureReason |
Use webhooks to get notified when refund status changes rather than polling
this endpoint.
⌘I