The get_refund_status() method is used to retrieve the status of the initiated refund by passing the below parameters:
Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
refund_id | Str | yes | Refund Id created by the merchant at the time of initiating the refund |
Example :
from phonepe.sdk.pg.subscription.v2.subscription_client import SubscriptionClient
client_id = "<client_id>"
client_secret = "<client_secret>"
client_version = 1 # insert your client version here
env = Env.SANDBOX # change to Env.PRODUCTION when you go live
subscription_client = SubscriptionClient.get_instance(client_id,client_secret,client_version,env)
refund_id = "<REFUND_ID>"
refund_status_response = SubscriptionClient.get_refund_status(refund_id)
state = refund_status_response.state
Returns:
It returns a RefundStatusResponse Object
RefundStatusResponse
Property | Data Type | Description |
---|---|---|
merchant_id | Str | Merchant Id who initiated the refund |
merchant_refund_id | Str | Refund Id created by the merchant at the time of refund initiation |
original_merchant_order_id | Str | Order Id for which refund has initiated. Created by the merchant at the time of order creation |
amount | Int | Amount to refund |
state | Str | State of the refund |
payment_details | List<PaymentRefundDetail> | Contains the list of details of each transaction attempt made corresponding to this particular order |
PaymentRefundDetail :
Property | Data Type | Description |
---|---|---|
transaction_id | Str | Transaction Id generated by the PhonePe |
| Str | Mode of Payment. It can be anyone of the following modes: 1. UPI_INTENT 2. UPI_COLLECT 3. UPI_QR 4. CARD 5. TOKEN 6. NET_BANKING |
timestamp | Int | Timestamp of the attempted transaction in epoch |
state | Str | Attempted transaction state. It can be any one of the following states: 1. COMPLETED 2. FAILED 3. PENDING |
| Str | Error code present only when the transaction state is Failed |
detailed_error_code | Str | Detailed Error Code present only when transaction state is Failed |
rail | PaymentRail | Contains processing rail details under which transaction attempt is made. |
instrument | PaymentInstrumentV2 | Contains instrument details of that particular transaction Id |
split_instruments | List<InstrumentCombo> | Type of transaction instrument. It can be any one of the following types: 1. ACCOUNT 2. CREDIT_CARD 3. DEBIT_CARD 4. NET_BANKING |