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.
Consists of two parts.
Username: API Key obtained from Juspay dashboard
Password: Empty string
Example:-
Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
Merchant ID provided by Juspay
Example:-
merchant-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.
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.
Example:- customer_1122
application/x-www-form-urlencoded
Order Id of the order for which you want to proceed with refund
Example:- 1418394476
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 and alphanumeric. Special characters are not recommended as some of the underlying gateway/aggregator might have restrictions.
Amount that has to be refunded. Amount has to be less than or equal to the effective_amount of the order that is not yet refunded.If this parameter is not passed, then the order is refunded entirely.
The minimum amount that can be refunded is 1 INR.
Allows merchants to pass additional contextual information while initiating a refund.
Example:- Refund Note / Description)
Refund note or merchant reference text describing the reason or context for the refund.
If the metaData field is included in the refund request, it is stored internally with the refund and will be returned in the Refund API response, Order Status API, and the Refund Webhook Payload.
Use Case: Merchants can use this field to:
Store refund reason
Pass internal ticket/reference number
Track refund context in reconciliation systems
eulwh5QbZSBvwpt7333f3
merchant_success-JP1636474794-1
eulwh5QbZSBvwpt7333f3
merchant_success-JP1636474794-1
JP1636474794
RAZORPAY
INR
2021-11-09T16:20:52Z
CHARGED
The unique request id that is passed during refund initiation. Do not pass any special characters.
The status of the refund initiated. Initial status will always be PENDING
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.
The type of refund. Values can be STANDARD, INSTANT
The name of gateway
The refund id provided by the PG
The source of initiation.
The reference id provided by PG, if not available then its mapped to unique request id.
The error message provided by the PG
The error code provided by the PG
The timestamp of refund creation
The refund amount passed in the request
Refund note passed via metaData during refund initiation
https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
https://api.juspay.in/merchant/pay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77?mobile=true
https://api.juspay.in/merchant/ipay/ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
merchant_success-JP1636474794-1
156555
SUCCESS
SUCCESS
pay_IJZKtTpkiYWE24
2021-11-09T16:21:11Z
156555
JP1636474794
testmid
merchant_success
ordeh_57dfd768bb7d4896bc0c3f30bc9ad77
testmid
2021-11-09T16:19:55Z
9999999999
testcardenc1
test@gmail.com
INR
2024
12
CREDIT
17a2ec4f27c918ttvbc58c9ae74090e
JP Morgan
411111
32qqi3svf5t5t37fq7ura2rgqqb
VISA
THREE_DS
Amount that can be refunded without making the offer ineligible (for offer transactions). Calculated as the difference between the order amount and the Offer minimum order amount. For maximum allowed refund amount for a transaction , refer to the effective_amount field
REFUND_DUPLICATE_REQUEST
A refund request is already being processed for this transaction id and amount combination
A refund request is already being processed for this unique request id and order id combination
A refund has already been processed for this order with this unique request id
CASH_PAYMENTS_REFUNDS_NOT_SUPPORTED
Refunds cannot be initiated for COD orders
INVALID_AMOUNT
Amount is invalid
INVALID_ORDERID
Not found
ORDER_TOO_OLD
Refunds cannot be initiated for orders older than 365 days
CANNOT_PROCESS_AUTHORIZED_ORDER
Refunds cannot be processsed for a pending/authorised order
SPLIT_PAYMENTS_ORDER_BASED_REFUND_NOT_SUPPORTED
Please use the txn_id-based Refund API
INVALID_AMOUNT_REFUND
Refund amount exceeds the total refundable amount
REFUND_CREATE_EXCEEDED_THE_LIMIT
Refund creation limit exceeded
REFUND_REJECTED
Refunds are not supported for the gateway with which the forward order/transaction was processed
UNSUCCESSFUL_ORDER_PROCESS_FAILURE
This refund cannot be processed as the forward order/transaction is not successful
INVALID_AMOUNT
Refund cannot be initiated with amount lesser than Rs.1
VALUE_NOT_FOUND
Success response ID
SUCCESS_OR_PARTIAL_SUCCESS_TRANSACTION_NOT_FOUND
Invalid request
INVALID
Bad request
error
access_denied

