PG Check Status

This method is used to check the status of a transaction.

Parameters

ParameterTypeMandatoryDescription
merchantTransactionIdmixedYesMerchant 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:

PropertyTypeDescription
merchantIdmixedThe merchant ID
merchantTransactionIdmixedThe merchant transaction id
transactionIdmixedThe PhonePe unique identifier of the transaction.
amountintegerThe transaction amount
responseCodemixedThe response code.
statemixedThe transaction state. Can be PENDING, COMPLETED, or FAILED.
paymentInstrumentPaymentInstrumentThe 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();