---
page_source: https://juspay.io/sea/docs/hyper-checkout-sea/web/base-sdk-integration/refund-order-api
page_title: Refund Order API
---

## API Version: default


# Refund Order API



Create a refund for an Order. Refunds can be initiated only for transactions that are CHARGED. The response of refund initiation is similar to that of order status API Response with the addition of refund block.## Endpoints:
- Sandbox: https://sandbox.juspay.in/orders/{order_id}/refunds

- Production: https://api.juspay.in/orders/{order_id}/refunds

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

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

* Username: API Key obtained from Juspay dashboard
* Password: Empty string
- Value:  <p>Example:- <br> Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==</p>
- Tags: Base64 Encoded Username:Password, Mandatory
## Headers:

#### version:
Pass the current date in YYYY-MM-DD format
- Tags: string, Required

#### Content-Type:
application/x-www-form-urlencoded
- Tags: string, Required

#### x-merchantid:
The merchant_id/username that you hold at Juspay
- Tags: string, Required
## Sample Code Snippets:
### Sample Request:

#### Request Code Snippet:

```request
curl -X POST https://api.juspay.in/orders/1418394476/refunds \
-u your_api_key: \
-H "version:2023-06-30" \
-H 'Content-Type: application/x-www-form-urlencoded'\
-H 'x-merchantid: merchant_id'\
-d "unique_request_id=xyz123" \
-d "amount=100.00"
```

### Sample Response:

#### Response:
```json
{
  "udf9": "",
  "udf8": "",
  "udf7": "",
  "udf6": "",
  "udf5": "",
  "udf4": "",
  "udf3": "",
  "udf2": "",
  "udf10": "",
  "udf1": "",
  "txn_uuid": "eulwh5QbZSBvwpt7333f3",
  "txn_id": "merchant_success-JP1636474794-1",
  "txn_detail": {
    "txn_uuid": "eulwh5QbZSBvwpt7333f3",
    "txn_id": "merchant_success-JP1636474794-1",
    "txn_amount": 1,
    "tax_amount": null,
    "surcharge_amount": null,
    "status": "CHARGED",
    "redirect": true,
    "order_id": "JP1636474794",
    "net_amount": 1,
    "gateway_id": 23,
    "gateway": "STRIPE",
    "express_checkout": true,
    "error_message": "",
    "error_code": "",
    "currency": "SGD",
    "created": "2021-11-09T16:20:52Z"
  },
  "status_id": 21,
  "status": "CHARGED",
  "rewards_breakup": null,
  "return_url": "",
  "refunds": [
    {
      "unique_request_id": "TEST1637681731",
      "status": "PENDING",
      "sent_to_gateway": false,
      "refund_type": "STANDARD",
      "refund_source": "STRIPE",
      "ref": null,
      "initiated_by": "API",
      "id": null,
      "error_message": "",
      "error_code": null,
      "created": "2021-11-23T15:35:32Z",
      "amount": 1
    }
  ],
  "refunded": true,
  "product_id": "",
  "payment_method_type": "CARD",
  "payment_method": "VISA",
  "payment_links": {
    "web": "https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77",
    "mobile": "https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77?mobile=true",
    "iframe": "https://api.juspay.in/merchant/ipay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77"
  },
  "payment_gateway_response": {
    "txn_id": "merchant_success-JP1636474794-1",
    "rrn": "156555",
    "resp_message": "SUCCESS",
    "resp_code": "SUCCESS",
    "epg_txn_id": "pay_IJZKtTpkiYWE24",
    "created": "2021-11-09T16:21:11Z",
    "auth_id_code": "156555"
  },
  "order_id": "JP1636474794",
  "offers": [],
  "metadata": {
    "STRIPE:gateway_reference_id": "testmid"
  },
  "merchant_id": "merchant_success",
  "id": "ordeh_57dfd768bb7d4896bc0c3f30bc9ad77",
  "gateway_reference_id": "testmid",
  "gateway_id": 23,
  "effective_amount": 1,
  "date_created": "2021-11-09T16:19:55Z",
  "customer_phone": "99999999",
  "customer_id": "testcardenc1",
  "customer_email": "test@gmail.com",
  "currency": "SGD",
  "card": {
    "using_token": false,
    "using_saved_card": true,
    "saved_to_locker": false,
    "name_on_card": "test",
    "last_four_digits": "",
    "expiry_year": "2024",
    "expiry_month": "12",
    "card_type": "CREDIT",
    "card_reference": "17a2ec4f27c918ttvbc58c9ae74090e",
    "card_issuer": "JP Morgan",
    "card_isin": "411111",
    "card_fingerprint": "32qqi3svf5t5t37fq7ura2rgqqb",
    "card_brand": "VISA"
  },
  "bank_pg": null,
  "bank_error_message": "",
  "bank_error_code": "",
  "auth_type": "THREE_DS",
  "amount_refunded": 1,
  "amount": 1
}
```

## Body Parameters:
### Parameters:

#### unique_request_id:
- Description: Request ID that uniquely identifies this request. You cannot reuse the value for two different refund requests. This is to avoid processing duplicate refund requests.The length of the `unique_request_id` should be less than 21 characters
- Tags: string, Required

#### amount:
- Description: Amount that has to be refunded. Amount has to be less than or equal to the amount of the order that is not yet refunded. If this parameter is not passed, then the order is refunded entirely
- Tags: Double, Required
## API Responses:
### 200:

#### udf1-10:
- Tags: string

#### txn_uuid:
- Description: eulwh5QbZSBvwpt7333f3
- Tags: string

#### txn_id:
- Description: merchant_success-JP1636474794-1
- Tags: string

#### txn_detail:
- Value:
  - **Txn_uuid**:
    - Description: eulwh5QbZSBvwpt7333f3
    - Tags: string
  - **Txn_id**:
    - Description: merchant_success-JP1636474794-1
    - Tags: string
  - **Txn_amount**:
    - Tags: integer
  - **Tax_amount**:
  - **Surcharge_amount**:
  - **Status**:
    - Description: CHARGED
    - Tags: string
  - **Redirect**:
    - Tags: boolean
  - **Order_id**:
    - Description: JP1636474794
    - Tags: string
  - **Net_amount**:
    - Tags: integer
  - **Gateway_id**:
    - Tags: integer
  - **Gateway**:
    - Description: RAZORPAY
    - Tags: string
  - **Express_checkout**:
    - Tags: boolean
  - **Error_message**:
    - Tags: string
  - **Error_code**:
    - Tags: string
  - **Currency**:
    - Description: INR
    - Tags: string
  - **Created**:
    - Description: 2021-11-09T16:20:52Z
    - Tags: string
- Tags: object

#### status_id:
- Tags: integer

#### status:
- Description: CHARGED
- Tags: string

#### rewards_breakup:
- Tags: String

#### return_url:
- Tags: string

#### refunds:
- Description: 
### Payload
- **Object**:
  - Value:
    - **Unique_request_id**:
      - Description: The unique request id that is passed during refund initiation. Do not pass any special characters.
      - Tags: String
    - **Status**:
      - Description: The status of the refund initiated. Initial status will always be PENDING
      - Tags: String
    - **Sent_to_gateway**:
      - Description: The flag denotes if the refund was initiated to gateway. The initial status is always false, as refunds are queued at juspay for a max of 15minutes.
      - Tags: String
    - **Refund_type**:
      - Description: The type of refund. Values can be STANDARD, INSTANT
      - Tags: String
    - **Refund_source**:
      - Description: The name of gateway
      - Tags: String
    - **Ref**:
      - Description: The refund id provided by the PG
      - Tags: String
    - **Initiated_by**:
      - Description: The source of initiation.
      - Tags: String
    - **Id**:
      - Description: The reference id provided by PG, if not available then its mapped to unique request id.
      - Tags: String
    - **Error_message**:
      - Description: The error message provided by the PG
      - Tags: String
    - **Error_code**:
      - Description: The error code provided by the PG
      - Tags: String
    - **Created**:
      - Description: The timestamp of refund creation.
      - Tags: String
    - **Amount**:
      - Description: The refund amount passed in the request.
      - Tags: integer
  - Tags: object

- Tags: array of Objects

#### refunded:
- Tags: boolean

#### product_id:
- Tags: string

#### payment_method_type:
- Description: CARD
- Tags: string

#### payment_method:
- Description: VISA
- Tags: string

#### payment_links:
- Value:
  - **Web**:
    - Description: https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
    - Tags: string
  - **Mobile**:
    - Description: https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77?mobile=true
    - Tags: string
  - **Iframe**:
    - Description: https://api.juspay.in/merchant/ipay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
    - Tags: string
- Tags: object

#### payment_gateway_response:
- Value:
  - **Txn_id**:
    - Description: merchant_success-JP1636474794-1
    - Tags: string
  - **Rrn**:
    - Description: 156555
    - Tags: string
  - **Resp_message**:
    - Description: SUCCESS
    - Tags: string
  - **Resp_code**:
    - Description: SUCCESS
    - Tags: string
  - **Epg_txn_id**:
    - Description: pay_IJZKtTpkiYWE24
    - Tags: string
  - **Created**:
    - Description: 2021-11-09T16:21:11Z
    - Tags: string
  - **Auth_id_code**:
    - Description: 156555
    - Tags: string
- Tags: object

#### order_id:
- Description: JP1636474794
- Tags: string

#### offers:
- Tags: array

#### metadata:
- Value:
  - **RAZORPAY:gateway_reference_id**:
    - Description: testmid
    - Tags: string
- Tags: object

#### merchant_id:
- Description: merchant_success
- Tags: string

#### id:
- Description: ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
- Tags: string

#### gateway_reference_id:
- Description: testmid
- Tags: string

#### gateway_id:
- Tags: integer

#### effective_amount:
- Tags: integer

#### date_created:
- Description: 2021-11-09T16:19:55Z
- Tags: string

#### customer_phone:
- Description: 9999999999
- Tags: string

#### customer_id:
- Description: testcardenc1
- Tags: string

#### customer_email:
- Description: test@gmail.com
- Tags: string

#### currency:
- Description: INR
- Tags: string

#### card:
- Value:
  - **Using_token**:
    - Tags: boolean
  - **Using_saved_card**:
    - Tags: boolean
  - **Saved_to_locker**:
    - Tags: boolean
  - **Name_on_card**:
    - Description: test
    - Tags: string
  - **Last_four_digits**:
    - Tags: string
  - **Expiry_year**:
    - Description: 2024
    - Tags: string
  - **Expiry_month**:
    - Description: 12
    - Tags: string
  - **Card_type**:
    - Description: CREDIT
    - Tags: string
  - **Card_reference**:
    - Description: 17a2ec4f27c918ttvbc58c9ae74090e
    - Tags: string
  - **Card_issuer**:
    - Description: JP Morgan
    - Tags: string
  - **Card_isin**:
    - Description: 411111
    - Tags: string
  - **Card_fingerprint**:
    - Description: 32qqi3svf5t5t37fq7ura2rgqqb
    - Tags: string
  - **Card_brand**:
    - Description: VISA
    - Tags: string
- Tags: object

#### bank_pg:

#### bank_error_message:
- Tags: string

#### bank_error_code:
- Tags: string

#### auth_type:
- Description: THREE_DS
- Tags: string

#### amount_refunded:
- Tags: integer

#### amount:
- Tags: integer
### 400:

#### Duplicate unique_request_id:
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: duplicate.call
    - Tags: String
  - **Error_message**:
    - Description: A refund call was already completed with this unique_request_id for the order.
    - Tags: String
- Tags: JSON

#### Duplicate Refund Request within 5 seconds:
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: duplicate.call
    - Tags: String
  - **Error_message**:
    - Description: A refund call was already processing with this amount for the order.
    - Tags: String
- Tags: JSON

#### Refund amount greater than refundable:
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: invalid.amount.exceeded
    - Tags: String
  - **Error_message**:
    - Description: Refund amount exceeds the refundable amount.
    - Tags: String
- Tags: JSON

#### Amount/unique_request_id not passed:
- Value:
  - **Status**:
    - Description: Bad Request
    - Tags: String
  - **Error_code**:
    - Description: Mandatory fields are missing
    - Tags: String
  - **Error_message**:
    - Description: Mandatory fields are missing
    - Tags: String
- Tags: JSON

#### Refund Amount is 0:
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: invalid amount
    - Tags: String
  - **Error_message**:
    - Description: Amount is invalid
    - Tags: String
- Tags: JSON

#### Invalid Order id:
- Value:
  - **Status**:
    - Description: NOT_FOUND
    - Tags: String
  - **Status_id**:
    - Description: 40
    - Tags: String
  - **Order_id**:
    - Description: 66721145_keexeV8cNyb7DrYzs
    - Tags: String
- Tags: JSON

#### Unsuccessful order:
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: invalid.order.not_successful
    - Tags: String
  - **Error_message**:
    - Description: Cannot process unsuccessful order
    - Tags: String
- Tags: JSON

#### Refund limit exceeds:
- Description: 25 refunds per order is the default limit
- Value:
  - **Status**:
    - Description: ERROR
    - Tags: String
  - **Error_code**:
    - Description: request.exceeded
    - Tags: String
  - **Error_message**:
    - Description: Refund create exceeded the limit
    - Tags: String
- Tags: String
### 401:

#### status:
- Description: error
- Tags: String

#### error_code:
- Description: access_denied
- Tags: String
