- [HTTP request](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#body.request_body)
  - [JSON representation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#body.response_body)
- [CancelMandateResponse](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#CancelMandateResponse)
  - [JSON representation](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#CancelMandateResponse.SCHEMA_REPRESENTATION)
- [CancelMandateResultCode](https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#CancelMandateResultCode)

Initiates a mandate cancellation on the user's account with the integrator.

This cancels the existing mandate on the user's account. The `mandateId` identifies which mandate is being cancelled. This is the `requestId` of the `createMandateWithOptionalInstantPayment` call.

If the mandate has expired or is already cancelled, consider it a successful cancel 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/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ErrorResponse`.

An example request looks like:


    {
      "requestHeader": {
        "protocolVersion": {
          "major": 1,
          "minor": 0,
          "revision": 0
        },
        "requestId": "bWVyY2hhbnQgdHJhbnNhY3Rpb24gaWQ",
        "requestTimestamp": "1502220196078"
      },
      "paymentIntegratorAccountId": "InvisiCashIN_INR",
      "mandateId": "Gbsdfju4bnQgdHJXPFWSDhgdka4"
    }

An example response looks like:


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

### HTTP request

`POST https://www.integratorhost.example.com/integrator-base-path/refundable-one-time-payment-code-v1/cancelMandate`

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/RequestHeader`) }, "paymentIntegratorAccountId": string, "mandateId": string } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-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. |
| `mandateId` | `string` **REQUIRED**: The Google generated ID of the mandate to cancel. |

### 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/refundable-one-time-payment-code-v1/guides/connectivity/protocol-standards#http_status_codes).

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

## CancelMandateResponse

Response object for the `cancelMandate` method call.

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader`) }, "result": enum (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#CancelMandateResultCode`) } ``` |

| Fields ||
|---|---|
| `responseHeader` | ``object (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader`)`` **REQUIRED**: Common header for all responses. |
| `result` | ``enum (`https://developers.google.com/pay/refundable-one-time-payment-code-v1/payment-integrator-refundable-one-time-payment-code-api/cancelMandate#CancelMandateResultCode`)`` **REQUIRED**: The result of the cancel mandate call. |

## CancelMandateResultCode

Result codes for `refundable-one-time-payment-code-v1.cancelMandate` method call.

| Enums ||
|---|---|
| `CANCEL_MANDATE_RESULT_CODE_UNSPECIFIED` | Do not ever set this default value! |
| `SUCCESS` | The mandate was cancelled successfully. |