> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/integrations/prism/api-reference/dispute-service/defend.md).

# Defend

## Overview

The `Defend` RPC submits a formal defense against a chargeback dispute. This presents your argument with a reason code to the issuing bank, along with any previously submitted evidence.

**Business Use Case:** After submitting evidence, you must formally contest the dispute before the deadline. This RPC notifies the bank that you are challenging the chargeback and provides your defense reasoning.

## Purpose

**Why formally defend disputes?**

| Scenario                         | Defense Strategy                              | Reason Code                     |
| -------------------------------- | --------------------------------------------- | ------------------------------- |
| **Product delivered**            | Customer received product, delivery confirmed | GOODS\_SERVICES\_RECEIVED       |
| **Valid transaction**            | Customer authorized, 3DS authenticated        | TRANSACTION\_AUTHORIZED         |
| **Refund already issued**        | Customer was already refunded                 | REFUND\_ISSUED                  |
| **Cancellation policy followed** | Customer cancelled outside policy window      | CANCELLATION\_POLICY\_DISCLOSED |

**Key outcomes:**

* Dispute status changes to CHALLENGED
* Defense submitted to issuing bank
* Bank begins review process
* Awaiting final resolution (60-75 days)

## Request Fields

| Field                      | Type   | Required | Description                              |
| -------------------------- | ------ | -------- | ---------------------------------------- |
| `merchant_dispute_id`      | string | Yes      | Your unique dispute reference            |
| `connector_transaction_id` | string | Yes      | Original transaction ID                  |
| `dispute_id`               | string | Yes      | Connector's dispute identifier           |
| `reason_code`              | string | No       | Defense reason code (connector-specific) |

## Response Fields

| Field                   | Type                | Description                                   |
| ----------------------- | ------------------- | --------------------------------------------- |
| `dispute_id`            | string              | Connector's dispute identifier                |
| `dispute_status`        | DisputeStatus       | Updated status: CHALLENGED                    |
| `connector_status_code` | string              | Connector-specific status code                |
| `error`                 | ErrorInfo           | Error details if defense failed               |
| `status_code`           | uint32              | HTTP-style status code                        |
| `response_headers`      | map\<string,string> | Connector-specific response headers           |
| `merchant_dispute_id`   | string              | Your dispute reference (echoed back)          |
| `raw_connector_request` | SecretString        | Raw API request sent to connector (debugging) |

## Example

### Request (grpcurl)

```bash
grpcurl -H "x-connector: stripe" \
  -H "x-connector-config: {\"config\":{\"Stripe\":{\"api_key\":\"$STRIPE_API_KEY\"}}}" \
  -d '{
    "merchant_dispute_id": "dispute_001",
    "connector_transaction_id": "pi_3Oxxx...",
    "dispute_id": "dp_1Oxxx...",
    "reason_code": "goods_services_received"
  }' \
  localhost:8080 \
  types.DisputeService/Defend
```

### Response

```json
{
  "dispute_id": "dp_1Oxxx...",
  "dispute_status": "CHALLENGED",
  "status_code": 200
}
```

## Next Steps

* [Get](/integrations/prism/api-reference/dispute-service/get.md) - Check dispute resolution status
* [Accept](/integrations/prism/api-reference/dispute-service/accept.md) - Alternative: concede the dispute


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hyperswitch.io/integrations/prism/api-reference/dispute-service/defend.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
