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.
Refunds Flow
Handles returning money to the customer. Covers both Full and Partial refunds.
Step 1: Create a unique request id (e.g., REF_ORD123_TIMESTAMP). This is mandatory for idempotency. It prevents accidental double refunds if the network times out.
Step 2: Call the Refund Order API
Pass the unique_request_id (Required).
For Full Refund: Do not send an amount field (or send the full order value).
For Partial Refund: Send the specific amount (e.g., "50.00") to be refunded.
Step 3: Parse the Response
Check the status field.
Scenario A (Success): If status is REFUNDED, the money has been initiated back to the source.
Scenario B (Pending): If status is PENDING, the bank is processing it. Rely on the Webhook or Order Status API
for final confirmation.
Scenario C (Failure): If status is FAILURE, the refund was declined.
Consists of two parts.
Username: API Key obtained from Juspay dashboard
Password: Empty string
Example:-
Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
Pass the current date in YYYY-MM-DD format
application/x-www-form-urlencoded
The merchant_id/username that you hold at Juspay
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
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
Transaction UUID
Transaction ID
Transaction UUID
Example :eulwh5QbZSBvwpt7333f3
Transaction id
Example :merchant_success-JP1636474794-1
Order Id passed during order creation
Example JP1636474794
The gateway field indicates which payment processor was responsible for the original transaction and will handle the refund processing.
ISO string of the currency.
Timestamp
2021-11-09T16:20:52Z
Status ID is a numeric id corresponding to the status value
Status of the order. For information on different order status and handling, refer here
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 refund amount passed in the request
The timestamp of refund creation
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
The json object with the details receive from PG
Transaction ID for the payment attempt.
Example : merchant_success-JP1636474794-1
The bank reference number provided by the gateway
Example : 156555
The response message provided by the gateway
Example : SUCCESS
The response code provided by the gateway
The gateway transaction id
Example pay_IJZKtTpkiYWE24
The transaction creation timestamp
Example : 2021-11-09T16:21:11Z
Auth code provided by the gateway for the transaction.
Example : 156555
OrderId provided in the request
testmid
The merchant id provided by Juspay
Unique ID generated by JusPay for the given order
testmid
Order creation timestamp in UTC
Example: 2021-11-09T16:19:55Z
The phone number of the customer provided during order creation
The customer id provided during order creation
The email Id of the customer provided during order creation
The currency provided during order creation.
The json containing the details of the card used for the transaction.
true if transaction was done via a saved card
false if transaction via new card/unsaved card
true if card was saved to locker, else false
The name on card used for the transaction
The last four digit of the card used
The expiry year of the card used for the transaction
2024
The expiry month of the card used for the transaction
Indicates if the card is either CREDIT or DEBIT
17a2ec4f27c918ttvbc58c9ae74090e
Indicates the bank which issued the card
Example : JP Morgan
The first six digit of the card used for the transaction
example :411111
The unique identifier for the card
Example : 32qqi3svf5t5t37fq7ura2rgqqb
The provider of the card, can be VISA, RUPAY etc.
Detailed card type classification (e.g. CREDIT, DEBIT)
Indicates the type of token used for the transaction (e.g. CARD)
List of tokens associated with the card, if any
Country where the card issuing bank is registered
Example:Brazil
Authentication type used for the transaction (e.g. THREE_DS)
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
The user defined fields passed during order creation. Empty in case not passed
ERROR
duplicate.call
A refund call was already completed with this unique_request_id for the order.
ERROR
duplicate.call
A refund call was already processing with this amount for the order.
ERROR
invalid.amount.exceeded
Refund amount exceeds the refundable amount.
Bad Request
Mandatory fields are missing
Mandatory fields are missing
ERROR
invalid amount
Amount is invalid
NOT_FOUND
40
66721145_keexeV8cNyb7DrYzs
ERROR
invalid.order.not_successful
Cannot process unsuccessful order
25 refunds per order is the default limit
ERROR
request.exceeded
Refund create exceeded the limit
error
access_denied

