---
page_source: https://juspay.io/br/docs/hypercheckout-global/web/base-sdk-integration/cancel-order-api
page_title: Cancel Order 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://api.sandbox.juspay.io/merchants/{merchant_id}/order/{order_id}/cancel

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

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Base 64 encode of API key
- Value: Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: Base64 Encoded Username:Password, Required
## Headers:

#### Content-Type:
- Value: application/json
- 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.sandbox.juspay.io/merchants/{merchant_id}/order/{order_id}/cancel' \
--header 'Content-Type: application/json' \
--header 'x-merchantid: latamsbx' \
--header 'Authorization: Basic OTRDRxxxxxxTI4Og==' \
--data '{
    "cancel_reason": "Testing"
}'
```

### Sample Response:

#### Response:
```plaintext
{"success":false,"message":"No Data found for the given path"}
```

#### 400 Response:
```plaintext
{
    "error_message": "Order with id = \"ORDER176432906\" does not exist.",
    "status": "invalid_request_error",
    "error_info": {
        "user_message": "Could not find Order with order_id : ORDER176432906",
        "fields": [
            {
                "field_name": "order_id",
                "reason": "Invalid order_id."
            }
        ],
        "request_id": "7167f1f5-e6e0-4013-8687-962bee70a73f",
        "href": "NA",
        "developer_message": "order_id is invalid.",
        "code": "RESOURCE_NOT_FOUND",
        "category": "USER_ERROR"
    }
}
```

#### 401 Response:
```plaintext
{
    "status": "error",
    "error_code": "access_denied",
    "error_info": {
        "user_message": "Unauthorized.",
        "request_id": "0a671060-7c4a-444c-a06e-167eb90d47a4",
        "href": "NA",
        "developer_message": "Invalid API Key. Please pass a valid and active api key.",
        "code": "UNAUTHORIZED",
        "category": "USER_ERROR"
    }
}
```

## Path Parameters:

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

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

#### cancel_reason:
- Value: Testing
- Tags: String, Required
## API Responses:
### 200:

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

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

#### order_id:
- Value: 1747643180
- Tags: String
