This method is used to check the status of a transaction.
Parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
merchantTransactionId | mixed | Yes | Merchant transaction ID for which status is to be fetched. |
Example (Check Status)
const $MERCHANTID="<merchantId>";
const $SALTKEY="<saltKey>";
const $SALTINDEX="<saltIndex>";
const $env=Env::UAT;
const $SHOULDPUBLISHEVENTS=true;
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
$checkStatus = $phonePePaymentsClient->statusCheck("merchantTransactionId");
$state=$checkStatus->getState();
Returns
The function returns an PgCheckStatusResponse
object with the following properties:
PgCheckStatusResponse properties
Here is the response property table for the given model:
Property | Type | Description |
---|---|---|
merchantId | mixed | The merchant ID |
merchantTransactionId | mixed | The merchant transaction id |
transactionId | mixed | The PhonePe unique identifier of the transaction. |
amount | integer | The transaction amount |
responseCode | mixed | The response code. |
state | mixed | The transaction state. Can be PENDING, COMPLETED, or FAILED. |
paymentInstrument | PaymentInstrument | The PhonePe payment instrument used to perform the transaction. |
Note: The specific properties under payment_instrument will vary based on the type of payment instrument used.
Check status: UPI Instrument
Let’s see the details for the transaction after the payment is completed via UPI using the checkStatus
function.
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
$checkStatus = $phonePePaymentsClient->statusCheck("merchantTransactionId");
$paymentInstrument = $checkStatus->getPaymentInstrument();
$utr = $paymentInstrument->getUtr();
Check status: Card Instrument
Let’s see the details for the transaction after the payment is completed via Card using the checkStatus
function.
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
$checkStatus = $phonePePaymentsClient->statusCheck("merchantTransactionId");
$paymentInstrument = $checkStatus->getPaymentInstrument();
$pgTransactionId = $paymentInstrument->getPgTransactionId();
$pgAuthorizationCode = $paymentInstrument->getPgAuthorizationCode();
$bankId = $paymentInstrument->.getBankId();
$bankId = $paymentInstrument->.getArn();
Check status: NetBanking Instrument
Let’s see the details for the transaction after the payment is completed via NetBanking using the checkStatus
function.
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
$checkStatus = $phonePePaymentsClient->statusCheck("merchantTransactionId");
$paymentInstrument = $checkStatus->getPaymentInstrument();
$bankId = $paymentInstrument->getBankId();
$bankTransactionId = $paymentInstrument->getBankTransactionId();