PHP code example of fadlisaad / ipay88

1. Go to this page and download the library: Download fadlisaad/ipay88 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fadlisaad / ipay88 example snippets




class Payment {

	protected $_merchantCode;
	protected $_merchantKey;

	public function __construct()
	{
		parent::__construct();
		$this->_merchantCode = 'xxxxxx'; //MerchantCode confidential
		$this->_merchantKey = 'xxxxxxxxx'; //MerchantKey confidential
	}

	public function index()
	{
		$request = new IPay88\Payment\Request($this->_merchantKey);
		$this->_data = array(
			'MerchantCode' => $request->setMerchantCode($this->_merchantCode),
			'PaymentId' =>  $request->setPaymentId(1),
			'RefNo' => $request->setRefNo('EXAMPLE0001'),
			'Amount' => $request->setAmount('0.50'),
			'Currency' => $request->setCurrency('MYR'),
			'ProdDesc' => $request->setProdDesc('Testing'),
			'UserName' => $request->setUserName('Your name'),
			'UserEmail' => $request->setUserEmail('[email protected]'),
			'UserContact' => $request->setUserContact('0123456789'),
			'Remark' => $request->setRemark('Some remarks here..'),
			'Lang' => $request->setLang('UTF-8'),
			'Signature' => $request->getSignature(),
			'SignatureType' => $request->setSignatureType('SHA256'),
			'ResponseURL' => $request->setResponseUrl('http://example.com/response'),
			'BackendURL' => $request->setBackendUrl('http://example.com/backend')
			);

		IPay88\Payment\Request::make($this->_merchantKey, $this->_data);
	}
	
	public function response()
	{	
		$response = (new IPay88\Payment\Response)->init($this->_merchantCode);
		return $response;
	}
}