curl --location --request POST 'https://api.stateset.com/v1/refunds/refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"reason": "Customer requested to keep the product",
"notify_customer": true
}'
const refund = await stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
reason: "Customer requested to keep the product",
notify_customer: true
}
);
refund = stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
reason="Customer requested to keep the product",
notify_customer=True
)
{
"id": "refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "refund",
"order_id": "order_123456",
"customer_id": "cust_abc123",
"type": "partial",
"status": "cancelled",
"previous_status": "processing",
"reason": "product_damaged",
"reason_details": "Item arrived with scratches on the surface",
"cancellation": {
"reason": "Customer requested to keep the product",
"cancelled_at": "2024-06-21T10:00:00Z",
"cancelled_by": "user_456"
},
"amounts": {
"subtotal": 4999,
"tax": 450,
"shipping": 0,
"total": 5449,
"currency": "USD"
},
"timeline": [
{
"status": "created",
"timestamp": "2024-01-20T13:30:00Z",
"actor": "customer"
},
{
"status": "approved",
"timestamp": "2024-01-20T13:30:01Z",
"actor": "system"
},
{
"status": "processing",
"timestamp": "2024-01-20T13:30:02Z",
"actor": "system"
},
{
"status": "cancelled",
"timestamp": "2024-06-21T10:00:00Z",
"actor": "user_456",
"note": "Customer requested to keep the product"
}
],
"updated_at": "2024-06-21T10:00:00Z",
"notifications": {
"customer_notified": true,
"notification_sent_at": "2024-06-21T10:00:05Z"
}
}
Cancel a pending or processing refund
POST
/
v1
/
refunds
/
:id
/
cancel
curl --location --request POST 'https://api.stateset.com/v1/refunds/refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"reason": "Customer requested to keep the product",
"notify_customer": true
}'
const refund = await stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
reason: "Customer requested to keep the product",
notify_customer: true
}
);
refund = stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
reason="Customer requested to keep the product",
notify_customer=True
)
{
"id": "refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "refund",
"order_id": "order_123456",
"customer_id": "cust_abc123",
"type": "partial",
"status": "cancelled",
"previous_status": "processing",
"reason": "product_damaged",
"reason_details": "Item arrived with scratches on the surface",
"cancellation": {
"reason": "Customer requested to keep the product",
"cancelled_at": "2024-06-21T10:00:00Z",
"cancelled_by": "user_456"
},
"amounts": {
"subtotal": 4999,
"tax": 450,
"shipping": 0,
"total": 5449,
"currency": "USD"
},
"timeline": [
{
"status": "created",
"timestamp": "2024-01-20T13:30:00Z",
"actor": "customer"
},
{
"status": "approved",
"timestamp": "2024-01-20T13:30:01Z",
"actor": "system"
},
{
"status": "processing",
"timestamp": "2024-01-20T13:30:02Z",
"actor": "system"
},
{
"status": "cancelled",
"timestamp": "2024-06-21T10:00:00Z",
"actor": "user_456",
"note": "Customer requested to keep the product"
}
],
"updated_at": "2024-06-21T10:00:00Z",
"notifications": {
"customer_notified": true,
"notification_sent_at": "2024-06-21T10:00:05Z"
}
}
This endpoint cancels a refund that is in pending or processing status. Once a refund is completed, it cannot be cancelled.
Authentication
This endpoint requires a valid API key withrefunds:write permissions.
Authorization: Bearer YOUR_API_KEY
Path Parameters
string
required
The unique identifier of the refund to cancel
Request Body
string
Reason for cancellation
boolean
Whether to notify customer of cancellation
Response
Returns the cancelled refund object.curl --location --request POST 'https://api.stateset.com/v1/refunds/refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"reason": "Customer requested to keep the product",
"notify_customer": true
}'
const refund = await stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
reason: "Customer requested to keep the product",
notify_customer: true
}
);
refund = stateset.refunds.cancel(
'refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
reason="Customer requested to keep the product",
notify_customer=True
)
{
"id": "refund_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "refund",
"order_id": "order_123456",
"customer_id": "cust_abc123",
"type": "partial",
"status": "cancelled",
"previous_status": "processing",
"reason": "product_damaged",
"reason_details": "Item arrived with scratches on the surface",
"cancellation": {
"reason": "Customer requested to keep the product",
"cancelled_at": "2024-06-21T10:00:00Z",
"cancelled_by": "user_456"
},
"amounts": {
"subtotal": 4999,
"tax": 450,
"shipping": 0,
"total": 5449,
"currency": "USD"
},
"timeline": [
{
"status": "created",
"timestamp": "2024-01-20T13:30:00Z",
"actor": "customer"
},
{
"status": "approved",
"timestamp": "2024-01-20T13:30:01Z",
"actor": "system"
},
{
"status": "processing",
"timestamp": "2024-01-20T13:30:02Z",
"actor": "system"
},
{
"status": "cancelled",
"timestamp": "2024-06-21T10:00:00Z",
"actor": "user_456",
"note": "Customer requested to keep the product"
}
],
"updated_at": "2024-06-21T10:00:00Z",
"notifications": {
"customer_notified": true,
"notification_sent_at": "2024-06-21T10:00:05Z"
}
}
โI