<!-- ZenPays documentation · https://docs.zenpayz.com/docs/rest-api/endpoints/refunds/cancel-refund -->

# Cancel Refund

Cancel a pending refund.

<EndpointHeader verb="DELETE" path="/merchant/api/v1/refund-intents/{refundId}" />

## Request

### Path Parameters

<ParamTable
  rows={[
    { name: "refundId", type: "string", required: true, desc: "Refund ID" },
  ]}
/>

### Headers

<ParamTable
  label="Header"
  rows={[
    { name: "Authorization", required: true, desc: "`Bearer {api_key}`" },
    { name: "X-Signature", required: true, desc: "HMAC-SHA256 signature" },
    { name: "X-Timestamp", required: true, desc: "ISO 8601 timestamp" },
    { name: "X-Secret-Salt", required: true, desc: "Secret salt for HMAC validation" },
  ]}
/>

## Response

### Success (200 OK)

```json
{
  "success": true,
  "data": {
    "refundId": "refund_1774683026458_oann5ibjf",
    "merchantId": "ZP_FIN_1774592804_0781001264",
    "customerId": "cust_mn8yfewm_37ntht",
    "transactionId": "txn_1774619159530_1_mn8yfmph_5iwb9b",
    "paymentIntentId": "pi_1774619159530_66d8s8v25",
    "amount": 30,
    "originalAmount": 100,
    "currency": "INR",
    "refundType": "partial",
    "status": "cancelled",
    "tspProvider": "sulifu_pay",
    "externalRefundId": null,
    "reason": "Customer requested refund",
    "createdAt": "2026-03-28T07:30:26.479Z",
    "completedAt": null,
    "failureReason": null,
    "processingTimeMs": null
  }
}
```

### Error Responses

<ErrorTable
  rows={[
    { code: "REFUND_NOT_CANCELLABLE", status: "400", message: "Refund cannot be cancelled" },
    { code: "REFUND_NOT_FOUND", status: "404", message: "Refund doesn't exist" },
  ]}
/>

<CodeRail>

## Examples

<Tabs groupId="language">
  <TabItem value="curl" label="cURL" default>

```bash
curl -X DELETE "https://api.zenpayz.com/merchant/api/v1/refund-intents/ref_xxxxx" \
  -H "Authorization: Bearer zp_test_xxxxx" \
  -H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
  -H "X-Signature: a1b2c3d4e5f6..." \
  -H "X-Secret-Salt: your_secret_salt"
```

  </TabItem>
  <TabItem value="sdk" label="SDK">

```javascript
await zenpays.refunds.cancel('ref_xxxxx');
```

  </TabItem>
</Tabs>

</CodeRail>
