- [HTTP request](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#body.request_body)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#body.response_body)
- [MrnPaymentDetails](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MrnPaymentDetails)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MrnPaymentDetails.SCHEMA_REPRESENTATION)
- [DefenseMaterialDocument](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefenseMaterialDocument)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefenseMaterialDocument.SCHEMA_REPRESENTATION)
- [MimeType](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MimeType)
- [DefendChargebackResponse](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResponse)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResponse.SCHEMA_REPRESENTATION)
- [DefendChargebackResultCode](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResultCode)

This method is called by Google to defend an Inquiry or a Chargeback.

If the endpoint encounters an error while processing the request, the response body from this endpoint should be of type `https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ErrorResponse`.

An example request looks like:


    {
      "requestHeader": {
        "protocolVersion": {
          "major": 1,
          "minor": 0,
          "revision": 0
        },
        "requestId": "G1MQ0YERJ0Q7LPM",
        "requestTimestamp": "1481899949606"
      },
      "paymentIntegratorAccountId": "InvisiCashUSA_USD",
      "captureRequestId": "G664529173",
      "defenseMaterialDocument" : {
         "mimeType": "APPLICATION_PDF",
         "payload": "ZGFzZGFkYXNkc2Rhc2Rhc2Rhc2Zhc2Y="
      }
    }

An example response looks like:


    {
      "responseHeader": {
        "responseTimestamp": "1481899950236"
      },
      "result": "SUCCESS"
    }

### HTTP request

`POST https://www.integratorhost.example.com/integrator-base-path/e-wallets-v1/defendChargeback`

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/RequestHeader`) }, "paymentIntegratorAccountId": string, "defenseMaterialDocument": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefenseMaterialDocument`) }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "captureRequestId": string, "mrnPaymentDetails": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MrnPaymentDetails`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/RequestHeader`)`` **REQUIRED**: Common header for all requests. |
| `paymentIntegratorAccountId` | `string` **REQUIRED**: This is the payment integrator account identifier that identifies contractual constraints around this transaction. |
| `defenseMaterialDocument` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefenseMaterialDocument`)`` **REQUIRED**: Present when the chargeback is defended using a PDF document. |
| **REQUIRED**: Details which identify the transaction and/or dispute. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `captureRequestId` | `string` A unique identifier for the payment that is being defended. This is the `requestId` generated by Google during the `captureFundsReservation` or `capture` which this request is associated with. |
| `mrnPaymentDetails` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MrnPaymentDetails`)`` Details to lookup payments that originated outside of GSP. |
| End of mutually exclusive fields. ||

### Response body

This method supports multiple return types. For additional information about what 4XX or 5XX HTTP status code to return with an `ErrorResponse`, consult the `ErrorResponse` object and [HTTP status codes documentation](https://developers.google.com/pay/e-wallets-v1/guides/connectivity/protocol-standards#http_status_codes).

| Possible response messages ||
|---|---|
| HTTP 200 Status | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResponse`)`` |
| HTTP 4XX / 5XX Status | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ErrorResponse`)`` |
| End of mutually exclusive fields. ||

## MrnPaymentDetails

Details to lookup payments which originated outside of GSP.

| JSON representation |
|---|
| ``` { "disputeCaseId": string, "merchantReferenceNumber": string, "merchantId": string } ``` |

| Fields ||
|---|---|
| `disputeCaseId` | `string` **REQUIRED**: The ID which identifies the dispute being represented. |
| `merchantReferenceNumber` | `string` **REQUIRED**: The merchant reference number of the original transaction. |
| `merchantId` | `string` **REQUIRED**: The MID for the payment processor that handled the original transaction. |

## DefenseMaterialDocument

A chargeback defense in the form of a PDF document.

| JSON representation |
|---|
| ``` { "mimeType": enum (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MimeType`), "payload": string } ``` |

| Fields ||
|---|---|
| `mimeType` | ``enum (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#MimeType`)`` **REQUIRED**: The MIME type of the document. Only the listed subset of IANA published MIME types are valid. |
| `payload` | `string` **REQUIRED**: The raw bytes of the PDF document encoded using base64url. |

## MimeType

The MIME type of a document.

| Enums ||
|---|---|
| `MIME_TYPE_UNSPECIFIED` | DO NOT USE |
| `IMAGE_PNG` | Equivalent of IANA published MIME type `image/png`. |
| `IMAGE_JPEG` | Equivalent of IANA published MIME type `image/jpeg`. |
| `IMAGE_GIF` | Equivalent of IANA published MIME type `image/gif`. |
| `APPLICATION_PDF` | Equivalent of IANA published MIME type `application/pdf`. |

## DefendChargebackResponse

Response object for the payment integrator hosted e-wallets-v1.defendChargeback method.

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ResponseHeader`) }, "result": enum (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResultCode`) } ``` |

| Fields ||
|---|---|
| `responseHeader` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ResponseHeader`)`` **REQUIRED**: Common header for all responses. |
| `result` | ``enum (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/defendChargeback#DefendChargebackResultCode`)`` **REQUIRED**: Result of this call. |

## DefendChargebackResultCode

Result codes for the `defendChargeback` method.

| Enums ||
|---|---|
| `DEFEND_CHARGEBACK_RESULT_CODE_UNSPECIFIED` | Do not ever set this default value! |
| `SUCCESS` | The defense was successfully submitted. |
| `CAPTURE_REQUEST_ID_NOT_FOUND` | The `captureRequestId` is not known to the recipient of the request. |
| `INVALID_DOCUMENT_FORMAT` | The document payload is malformed. |
| `CHARGEBACK_NOT_DEFENDABLE` | There is no recourse to defend this chargeback. |