GetPaymentStatus Class

The GetPaymentStatus class allows you to ** check the real-time status of a payment** using the IPC method GetPaymentStatus. This method queries the status of a payment by its original order ID and returns detailed information.

Useful for verifying transaction outcomes when a callback or notification hasn’t been received, or for implementing manual status checks.

Class Info

  • Namespace: Mypos\IPC
  • Located at: GetPaymentStatus.php
  • Extends: Mypos\IPC\Base
  • Purpose: Fetch the current status of a payment transaction using the original order ID.

Method Summary

MethodReturn TypeDescription
__construct(Mypos\IPC\Config $cnf)-Initializes the request with a configuration object.
process()Mypos\IPC\ResponseSends the API request and returns the payment status.
validate()boolValidates that required parameters are present (e.g. order ID).
getOrderID()stringRetrieves the order ID used to query the status.
setOrderID(string $orderID)GetPaymentStatusSets the order ID of the original transaction.

Inherited from Base

You can also access these inherited methods from the Base class:

  • _addPostParam()
  • _processPost()
  • _processHtmlPost()
  • getCnf(), setCnf()
  • getOutputFormat(), setOutputFormat()
  • isValidSignature()

Example Usage

<?php
namespace Mypos\IPC;
/**
 * Process IPC method: GetPaymentStatus.
 * Collect, validate and send API params
 */
class GetPaymentStatus extends Base
{
    private $orderID;
    public function __construct(Config $cnf)
    {
        $this->setCnf($cnf);
    }
    /**
     * Initiate API request
     *
     * @return Response
     */
    public function process()
    {
        $this->validate();
        $this->_addPostParam('IPCmethod', 'GetPaymentStatus');
        $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
        $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
        $this->_addPostParam('SID', $this->getCnf()->getSid());
        $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
        $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
        $this->_addPostParam('Source', $this->getCnf()->getSource());
        $this->_addPostParam('OrderID', $this->getOrderID());
        $this->_addPostParam('OutputFormat', $this->getOutputFormat());
        return $this->_processPost();
    }
    /**
     * Validate all set details
     *
     * @return boolean
     * @throws IPC_Exception
     */
    public function validate()
    {
        try {
            $this->getCnf()->validate();
        } catch (\Exception $ex) {
            throw new IPC_Exception('Invalid Config details: '.$ex->getMessage());
        }
        if ($this->getOrderID() == null || !Helper::isValidOrderId($this->getOrderID())) {
            throw new IPC_Exception('Invalid OrderId');
        }
        if ($this->getOutputFormat() == null || !Helper::isValidOutputFormat($this->getOutputFormat())) {
            throw new IPC_Exception('Invalid Output format');
        }
        return true;
    }
    /**
     * Original request order id
     *
     * @return string
     */
    public function getOrderID()
    {
        return $this->orderID;
    }
    /**
     * Original request order id
     *
     * @param string $orderID
     *
     * @return GetPaymentStatus
     */
    public function setOrderID($orderID)
    {
        $this->orderID = $orderID;
        return $this;
    }
}

Use Cases

Use the GetPaymentStatus class when:

  • You need to verify if a payment was completed or declined
  • You're missing a callback or need to manually check a payment
  • You’re building a reconciliation tool or custom admin dashboard