1. Go to this page and download the library: Download cmiecom/cmi-pay-bundle 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/ */
cmiecom / cmi-pay-bundle example snippets
namespace CmiPayBundle\Controller;
......
class CmiPayController extends AbstractController
{
public function requestPay(Request $request)
{
$params = new CmiPay();
// Setup new payment parameters
$okUrl = $this->generateUrl('cmi_pay_okFail', [], UrlGeneratorInterface::ABSOLUTE_URL);
$shopUrl = $baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
$failUrl = $this->generateUrl('cmi_pay_okFail', [], UrlGeneratorInterface::ABSOLUTE_URL);
$callbackUrl = $this->generateUrl('cmi_pay_callback', [], UrlGeneratorInterface::ABSOLUTE_URL);
$rnd = microtime();
//Sample Order Data:
$params->setGatewayurl('https://....')// Provided by CMI
->setclientid('600000000')// Provided by CMI
->setTel('05000000')
->setEmail('[email protected]')
->setBillToName('BillToName')
->setBillToCompany('BillToCompany')
->setBillToStreet1('BillToStreet1')
->setBillToStateProv('BillToStateProv')
->setBillToPostalCode('BillToPostalCode')
//.................
;
//.................
}
}
namespace CmiPayBundle\Controller;
......
class CmiPayController extends AbstractController
{
..........
public function callback(Request $request)
{
.......
}
}
namespace CmiPayBundle\Controller;
......
class CmiPayController extends AbstractController
{
..........
public function okFail(Request $request)
{
........
}
}
namespace CmiPayBundle\Controller;
......
class CmiPayController extends AbstractController
{
..........
public function hashValue($data)
{
$params = new CmiPay();
$params->setSecretKey('TEST1234');//Secret key generated from CMI Backoffice
..........
return $hash;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.