---
page_source: https://juspay.io/br/docs/hypercheckout-global/web/mandates/stop-mandate-execution
page_title: Stop Mandate Execution
---

## 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://payments.sandbox.juspay.in/mandates/{mandate_id}

- Production: https://payments.juspay.in/mandates/{mandate_id}

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

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

* Username: API Key obtained from Juspay dashboard
* Password: Empty string
  
  Example:- Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: required
## Headers:

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

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

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Code Snippets:

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

```request - stop mandate execution
curl --location 'https://api.juspay.in/mandates/vcPEf8ZJ3Tf7i8qFhCPEDs' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-routing-id: customer_1122'\
--header 'Authorization: Basic QjU3QTJCMTU5RTAx*************' \
--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": "BRL",
    "order_id": "test_recurring_1697711432",
    "date_created": "2023-10-19T10:30:32Z",
    "return_url": "",
    "product_id": "",
    "payment_links": {
        "iframe": "http://localhost:8080/orders/ordeu_e2a4ce9dcb004d2c84be20926aa23759/payment-page",
        "web": "http://localhost:8080/orders/ordeu_e2a4ce9dcb004d2c84be20926aa23759/payment-page",
        "mobile": "http://localhost:8080/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_ITAU",
    "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": "BRL",
        "express_checkout": false,
        "redirect": false,
        "txn_uuid": "moz2u5XNtZg2bB8czZ2",
        "gateway": "CIELO",
        "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:
