---
page_source: https://juspay.io/in/docs/hyper-checkout/web/base-sdk-integration/cancel-api
page_title: Cancel API
---

## API Version: default


# Cancel Order API



This document provides technical guidance for merchants to **cancel an active payment link**  via the API.

> **Note**
> * A cancelled order cannot be reactivated. A new payment link must be generated if needed.
> * Ensure the order being cancelled is in `ACTIVE` state; otherwise, cancellation may fail or have no effect.

## Endpoints:
- Sandbox: https://sandbox.juspay.in/merchants/{merchant_id}/order/{order_id}/cancel

- Production: https://api.juspay.in/merchants/{merchant_id}/order/{order_id}/cancel

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
- Value: Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: Base64 Encoded Username:Password, Required
## Headers:

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

#### x-merchantid:
Merchant ID provided by Juspay
- Value: merchant_id
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Request Code Snippet:

```request
curl --location 'https://api.juspay.in/merchants/{merchant_id}/order/{order_id}/cancel' \
--header 'Content-Type: application/json' \
--header 'x-merchantid: merchant_id' \
--header 'Authorization: Basic MDE4NXXXXXXXXXXXXXX5NTMwQzI1Og==' \
--data '{
    "cancel_reason": "Testing"
}'
```

### Sample Response:

#### Response:
```plaintext
{
    "status": "Success",
    "message": "Order cancelled successfully",
    "order_id": "1747643180"
}
```

## Path Parameters:

#### merchant_id:
Merchant ID provided by Juspay
- Tags: String, Required

#### order_id:
Order Id for which cancellation is required
- Tags: String, Required
## Body Parameters:
### Basic Parameters:

#### cancel_reason:
- Description: Reason for cancellation
- Value:  Example: Duplicate Request
- Tags: String, Required
## API Responses:
### 200:

#### status:
- Value: Success
- Tags: String

#### message:
- Value: Order cancelled successfully
- Tags: String

#### order_id:
- Value: Order ID for which the request was for
- Tags: String
