PHP code example of thanhvo-cse / worldpay
1. Go to this page and download the library: Download thanhvo-cse/worldpay 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/ */
thanhvo-cse / worldpay example snippets
use ThanhVo\Worldpay\WPG\Client;
class BeforeRequestListener implements ThanhVo\Worldpay\Event\ObserverInterface
{
/**
* @return string
*/
public function getSubject(): string
{
return Client::EVENT_BEFORE_REQUEST;
}
/**
* @param $data
* @return mixed
*/
public function onEvent($data)
{
// Handle your Observer here
var_dump($data);
}
}
$hosted = new \ThanhVo\Worldpay\WPG\Service\Hosted();
$beforeObserver = new BeforeRequestListener();
$hosted->addEventObserver($beforeObserver);
...