<!-- ZenPays documentation · https://docs.zenpayz.com/docs/rest-api/endpoints/payout-intents/cancel-payout-intent -->

# Cancel Payout Intent

Cancel a payout intent that has not yet been confirmed.

<EndpointHeader verb="POST" path="/payment/api/v1/payout-intents/{intentId}/cancel" />

## Request

### Path Parameters

<ParamTable
  rows={[
    { name: "intentId", type: "string", required: true, desc: "Payout intent 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" },
    { name: "Content-Type", required: true, desc: "`application/json`" },
  ]}
/>

### Body Parameters

<ParamTable
  rows={[
    { name: "reason", type: "string", desc: "Cancellation reason" },
  ]}
/>

## Response

### Success (200 OK)

```json
{
  "success": true,
  "data": {
    "intentId": "poi_xxxxx",
    "status": "cancelled",
    "message": "Payout intent cancelled"
  }
}
```

### Error Responses

<ErrorTable
  rows={[
    { code: "PAYOUT_INTENT_CANCEL_FAILED", status: "400", message: "Intent already confirmed or in terminal state" },
    { code: "NOT_FOUND", status: "404", message: "Intent not found" },
  ]}
/>

<CodeRail>

## Examples

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

```bash
curl -X POST "https://api.zenpayz.com/payment/api/v1/payout-intents/poi_xxxxx/cancel" \
  -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" \
  -H "Content-Type: application/json" \
  -d '{"reason": "No longer needed"}'
```

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

```javascript
await zenpays.payouts.cancelPayoutIntent('poi_xxxxx', 'No longer needed')
```

  </TabItem>
</Tabs>

</CodeRail>

## Related Endpoints

- [Create Payout Intent](/docs/rest-api/endpoints/payout-intents/create-payout-intent)
- [Get Payout Intent](/docs/rest-api/endpoints/payout-intents/get-payout-intent)
