It is used to retrieve the status of a refund using getRefundStatus()
function.
Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
refundId | String | yes | Refund Id created by the merchant at the time of initiating the refund |
Example :
<?php
require_once "vendor/autoload.php"; // Include Composer autoloader
use PhonePe\payments\v2\standardCheckout\StandardCheckoutClient;
use PhonePe\Env;
$clientId = "YOUR_CLIENT_ID"; // Replace with your Client ID
$clientVersion = 2; // Replace with your Client Version
$clientSecret = "YOUR_CLIENT_SECRET"; // Replace with your Client Secret
$env = Env::PRODUCTION;
$client = StandardCheckoutClient::getInstance(
$clientId,
$clientVersion,
$clientSecret,
$env
);
$merchantRefundId = "YOUR_MERCHANT_REFUND_ID"; // Replace with the refund ID you want to check
try {
$refundStatusCheckResponse = $client->getRefundStatus(
$merchantRefundId
);
// Process the refund status check response
echo "Refund ID: " . $refundStatusCheckResponse->getRefundId() . "\n";
echo "State: " . $refundStatusCheckResponse->getState() . "\n";
echo "Amount: " . $refundStatusCheckResponse->getAmount() . "\n";
} catch (\PhonePe\common\exceptions\PhonePeException $e) {
// Handle exceptions (e.g., log the error)
echo "Error checking refund status: " . $e->getMessage();
}
?>
Returns:
It returns a RefundStatusCheckResponse Object
RefundStatusResponse
Property | Data Type | Description |
---|---|---|
merchantRefundId | String | Refund Id created by the merchant at the time of refund initiation |
originalMerchantOrderId | String | Order Id for which refund has initiated. Created by the merchant at the time of order creation |
amount | Long | Amount to refund |
state | String | State of the refund |
paymentDetails | List<PaymentRefundDetail> | Contains the list of details of each transaction attempt made corresponding to this particular order |
PaymentRefundDetail :
Property | Data Type | Description |
---|---|---|
transactionId | String | Transaction Id generated by the PhonePe |
| String | 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 | Long | Timestamp of the attempted transaction in epoch |
state | String | Attempted transaction state. It can be any one of the following states: 1. COMPLETED 2. FAILED 3. PENDING |
| String | Error code present only when the transaction state is Failed |
detailedErrorCode | String | Detailed Error Code present only when transaction state is Failed |
splitInstruments | 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 |