PHP code example of naimeken / omnipay-masterpass
1. Go to this page and download the library: Download naimeken/omnipay-masterpass 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/ */
naimeken / omnipay-masterpass example snippets
$loader = ('Examples\\', __DIR__);
use Omnipay\Masterpass\Gateway;
use Examples\Helper;
$gateway = new Gateway();
$helper = new Helper();
try {
$params = $helper->getAuthorizeParams();
$response = $gateway->authorize($params)->send();
$result = [
'status' => $response->isSuccessful() ?: 0,
'token' => $response->getToken(),
'message' => $response->getMessage(),
'requestParams' => $response->getServiceRequestParams(),
'response' => $response->getData()
];
print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
throw new \RuntimeException($e->getMessage());
}
$loader = ('Examples\\', __DIR__);
use Omnipay\Masterpass\Gateway;
use Examples\Helper;
$gateway = new Gateway();
$helper = new Helper();
try {
$params = $helper->getPurchaseParams();
$response = $gateway->purchase($params)->send();
$result = [
'status' => $response->isSuccessful() ?: 0,
'redirect' => $response->isRedirect() ?: 0,
'message' => $response->getMessage(),
'requestParams' => $response->getServiceRequestParams(),
'response' => $response->getData()
];
print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
throw new \RuntimeException($e->getMessage());
}
$loader = ('Examples\\', __DIR__);
use Omnipay\Masterpass\Gateway;
use Examples\Helper;
$gateway = new Gateway();
$helper = new Helper();
try {
$params = $helper->getPurchase3dParams();
$response = $gateway->purchase($params)->send();
$result = [
'status' => $response->isSuccessful() ?: 0,
'redirect' => $response->isRedirect() ?: 0,
'message' => $response->getMessage(),
'requestParams' => $response->getServiceRequestParams(),
'response' => $response->getData()
];
print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
throw new \RuntimeException($e->getMessage());
}
$loader = ('Examples\\', __DIR__);
use Omnipay\Masterpass\Gateway;
use Examples\Helper;
$gateway = new Gateway();
$helper = new Helper();
try {
$params = $helper->getPayUPurchaseParams();
$response = $gateway->purchase($params)->send();
$result = [
'status' => $response->isSuccessful() ?: 0,
'redirect' => $response->isRedirect() ?: 0,
'message' => $response->getMessage(),
'requestParams' => $response->getServiceRequestParams(),
'response' => $response->getData()
];
print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
throw new \RuntimeException($e->getMessage());
}
$loader = ('Examples\\', __DIR__);
use Omnipay\Masterpass\Gateway;
use Examples\Helper;
$gateway = new Gateway();
$helper = new Helper();
try {
$params = $helper->getPayUPurchase3dParams();
$response = $gateway->purchase($params)->send();
$result = [
'status' => $response->isSuccessful() ?: 0,
'redirect' => $response->isRedirect() ?: 0,
'message' => $response->getMessage(),
'requestParams' => $response->getServiceRequestParams(),
'response' => $response->getData()
];
print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
throw new \RuntimeException($e->getMessage());
}