---
page_title: Stop Mandate Execution API
product: SmartGateway API Reference (Basic Auth)
page_source: https://smartgateway.hdfc.bank.in/docs/smartgateway-api-ref-basicauth/docs/mandates-subscriptions/stop-mandate-execution-api
openapi: https://smartgateway.hdfc.bank.in/docs/api/swagger?document=https%3A%2F%2Fsmartgateway.hdfc.bank.in%2Fdocs%2Fsmartgateway-api-ref-basicauth%2Fdocs%2Fmandates-subscriptions%2Fstop-mandate-execution-api
llms_txt: https://smartgateway.hdfc.bank.in/docs/llms.txt
product_llms_txt: https://smartgateway.hdfc.bank.in/docs/smartgateway-api-ref-basicauth/llms.txt
---

## API Version: default


# Stop Mandate Execution



There can always be cases when post calling Mandate Execution , there would be a requirement for stopping the execution post notification being sent on account 

1. User making payment themselves
2. Revoking it from merchant’s end
3. Where notification was sent then requirement of payment did not arrive.

In these cases, in order to stop the payment , we can stop the mandate payment order from being executed. 

> **Warning**
> Execution needs to be stopped at least 30 mins before scheduled execution time. 

## Endpoints:
- Sandbox: https://smartgatewayuat.hdfcbank.com/mandates/{mandate_id}

- Production: https://smartgateway.hdfcbank.com/mandates/{mandate_id}

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from HDFC Smart Gateway’s dashboard
* Password: Empty string
  
  Example:- Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: required
## Headers:

#### x-merchantid:
Merchant ID which would have been issues while registering with HDFC Smart Gateway.
- Value:  Example:- 7SucJZ2PCyoGY5vvW8Xa26
- Tags: String, Mandatory

#### Content-Type:
- Value:  application/x-www-form-urlencoded
- Tags: String, Mandatory
## Sample Code Snippets:
### Code Snippets:

#### Request - Stop Mandate Execution Code Snippet:

```request - stop mandate execution
curl --location 'https://smartgateway.hdfcuat.bank.in/mandates/vcPEf8ZJ3Tf7i8qFhCPEDs' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic <api key in base64 format>' \
--data-urlencode 'command=cancel_recurring_transaction' \
--data-urlencode 'order_id=test_recurring_1697711432'

```

### Sample Request and Response:

#### Response - Success:
```json
{
    "order_id": "test_recurring_1697711432",
    "txn_uuid": "moz2u5XNtZg2bB8czZ2",
    "txn_status": "JUSPAY_DECLINED",
    "response_message": "Transaction successfully terminated at Juspay end."
}

```

#### Updated Order Status post Successful Cancel:
```json
{
    "customer_email": "test@gmail.com",
    "customer_phone": "8861150466",
    "customer_id": "cst_2h0dwktdpsefeyk6",
    "status_id": 22,
    "status": "JUSPAY_DECLINED",
    "id": "ordeu_e2a4ce9dcb004d2c84be20926aa23759",
    "merchant_id": "juspay_test",
    "amount": 1,
    "currency": "INR",
    "order_id": "test_recurring_1697711432",
    "date_created": "2023-10-19T10:30:32Z",
    "return_url": "",
    "product_id": "",
    "payment_links": {
        "iframe": "http://smartgateway.hdfcuat.bank.in/orders/ordeu_e2a4ce9dcb004d2c84be20926aa23759/payment-page",
        "web": "http://smartgateway.hdfcuat.bank.in/orders/ordeu_e2a4ce9dcb004d2c84be20926aa23759/payment-page",
        "mobile": "http://smartgateway.hdfcuat.bank.in/orders/ordeu_e2a4ce9dcb004d2c84be20926aa23759/payment-page"
    },
    "udf1": "",
    "udf2": "",
    "udf3": "",
    "udf4": "",
    "udf5": "",
    "udf6": "",
    "udf7": "",
    "udf8": "",
    "udf9": "",
    "udf10": "",
    "txn_id": "juspay_test-test_recurring_1697711432-1",
    "payment_method_type": "NB",
    "auth_type": "THREE_DS",
    "payment_method": "JP_HDFC",
    "refunded": false,
    "amount_refunded": 0,
    "effective_amount": 1,
    "resp_code": null,
    "resp_message": null,
    "bank_error_code": "JP_852",
    "bank_error_message": "Transaction was declined by merchant.",
    "txn_uuid": "moz2u5XNtZg2bB8czZ2",
    "txn_detail": {
        "txn_id": "juspay_test-test_recurring_1697711432-1",
        "order_id": "test_recurring_1697711432",
        "status": "JUSPAY_DECLINED",
        "error_code": "JP_852",
        "net_amount": 1,
        "surcharge_amount": null,
        "tax_amount": null,
        "txn_amount": 1,
        "offer_deduction_amount": null,
        "gateway_id": 23,
        "currency": "INR",
        "express_checkout": false,
        "redirect": false,
        "txn_uuid": "moz2u5XNtZg2bB8czZ2",
        "gateway": "RAZORPAY",
        "error_message": "Transaction was declined by merchant.",
        "txn_object_type": "EMANDATE_PAYMENT",
        "source_object": "MANDATE",
        "source_object_id": "2198",
        "created": "2023-10-19T10:30:33Z"
    },
    "payment_gateway_response": {
        "resp_code": "JP_852",
        "rrn": "",
        "created": "2023-10-19T10:31:54Z",
        "epg_txn_id": null,
        "resp_message": "Transaction was declined by merchant.",
        "auth_id_code": "",
        "txn_id": "juspay_test-test_recurring_1697711432-1",
        "gateway_response": {},
        "debit_amount": null
    },
    "gateway_id": 23,
    "metadata": {
        "payment_page_client_id": "defaultclient"
    },
    "gateway_reference_id": null,
    "offers": []
}

```

#### Response - Request before 30 mins of execution:
```json
{
    "session_id": "NOREQID-7afd223d273c40a49b0180df574283e5",
    "user_message": "Cancel action not allowed.",
    "code": "INVALID_REQUEST",
    "type": "INVALID_REQUEST_ERROR",
    "message": "No scheduled recurring transactions are found."
}

```

#### Response - Unscheduled Respobse:
```json
{
    "session_id": "NOREQID-ba2e5589435048ad97207d039693392e",
    "user_message": "Cancel action not allowed.",
    "code": "INVALID_REQUEST",
    "type": "INVALID_REQUEST_ERROR",
    "message": "No active recurring transactions are scheduled."
}

```

#### Response - Invalid Command:
```json
{
    "status": "Invalid Request",
    "error_code": "bad_request",
    "error_message": "Invalid command"
}

```

#### Response - No Order Id:
```json
{
    "status": "Invalid Request",
    "error_code": "bad_request",
    "error_message": "Please send order_id"
}

```

## Path Parameters:

#### mandate_id:
Mandate Id of the mandate executed
- Tags: String, Mandatory
## Body Parameters:
### Parameters:

#### command:
- Value:  cancel_recurring_transaction
- Tags: String, Mandatory

#### order_id:
- Description: Order_id of the order that has been executed 
- Value:  Example - test_recurring_1697711432
- Tags: String, Mandatory
## API Responses:


---

## See Also

- [Mandate Revoke API](https://smartgateway.hdfc.bank.in/docs/smartgateway-api-ref-basicauth/docs/mandates-subscriptions/mandate-revoke-api)
- [Mandate List API](https://smartgateway.hdfc.bank.in/docs/smartgateway-api-ref-basicauth/docs/mandates-subscriptions/mandate-list-api)
