- [HTTP request](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#body.request_body)
  - [JSON representation](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#body.response_body)
- [CancelMandateResponse](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResponse)
  - [JSON representation](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResponse.SCHEMA_REPRESENTATION)
- [CancelMandateResult](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResult)
  - [JSON representation](https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResult.SCHEMA_REPRESENTATION)

Initiates cancelling the mandate that was created for recurring payment.

This cancels the existing mandate on the user's account. The `mandateId` identifies which mandate is being cancelled. It was generated by the vendor while creating the mandate.

If the mandate has expired or is already cancelled, consider it a successful cancellation rather than an error. Therefore, return a `success` response code.

The `requestId` within the header is the idempotency key and uniquely identifies this transaction.

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/india-cards-v1/payment-integrator-india-cards-api/ErrorResponse`.

An example request looks like:


    {
      "requestHeader": {
        "protocolVersion": {
          "major": 1
        },
        "requestId": "cmVxdWVzdDE",
        "requestTimestamp": {
          "epochMillis": "1481899949606"
        },
        "paymentIntegratorAccountId": "SpeedyPaymentsIndia_INR"
      },
      "mandateId": "MA061B00045154",
      "customerReferenceId": "customer57",
      "recurringPaymentReferenceId": "subscription201"
    }

An example response looks like:


    {
      "responseHeader": {
        "responseTimestamp": {
          "epochMillis": "1481899949611"
        }
      },
      "result": {
        "success": {}
      }
    }

### HTTP request

`POST https://www.integratorhost.example.com/integrator-base-path/v1/payment-integrator-authenticated-card-fop-api/cancelMandate`

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/RequestHeader`) }, "mandateId": string, "customerReferenceId": string, "recurringPaymentReferenceId": string } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/RequestHeader`)`` **REQUIRED**: Common header for all requests. |
| `mandateId` | `string` **REQUIRED** : The payment integrator generated ID that represents the mandate for this recurring payment. This is returned in the `capture` call when the recurring payment is first set up. |
| `customerReferenceId` | `string` **REQUIRED**: The Google generated customer reference ID that is associated with the mandate for this recurring payment. It is the same ID that is provided when the mandate creation is requested and is unique to that mandate. |
| `recurringPaymentReferenceId` | `string` **REQUIRED**: The Google generated recurring payment ID. It is the same ID that is provided when the mandate creation is requested and is unique to that mandate. |

### 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/india-cards-v1/guides/connectivity/protocol-standards#http_status_codes).

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

## CancelMandateResponse

Response object for the cancel mandate method.

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/ResponseHeader`) }, "result": { object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResult`) } } ``` |

| Fields ||
|---|---|
| `responseHeader` | ``object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/ResponseHeader`)`` **REQUIRED**: Common header for all responses. |
| `result` | ``object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/cancelMandate#CancelMandateResult`)`` **REQUIRED**: Result of this mandate cancellation. |

## CancelMandateResult

Result codes for cancel mandate.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "success": { object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/Empty`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| **REQUIRED**: The result of the cancel mandate. This message should only be used to report a terminal state for mandate cancellation. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `success` | ``object (`https://developers.google.com/pay/india-cards-v1/payment-integrator-india-cards-api/Empty`)`` The mandate was successfully cancelled. |
| End of mutually exclusive fields. ||