1. Go to this page and download the library: Download hopsey/blue-media-connector 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/ */
hopsey / blue-media-connector example snippets
use BlueMediaConnector\Transaction\RedirectMode;
$bmService = BlueMediaConnector\Factory::build("http://url.bm.pl/url", 123456, "verySecretString");
$bmService->makeTransaction(
new RedirectMode(), // typ wywolania: RedirectMode - przekierowanie, jest jeszcze wywołanie w tle, niezaimplemenotwane
1.50, // float - kwota
"Wplata", // opis
1, // gatewayId
"PLN", // currency
"[email protected]" // customer email
);
use BlueMediaConnector\Event\PreTransactionEvent;
$bmService->getEventManager()->attach(PreTransactionEvent::EVENT_PRE_TRANSACTION, function (PreTransactionEvent $event) {
/** @var BlueMediaConnector\Message\InitTransactionMessage */
$message = $event->getParam('message');
$message->amount; // 1.50
$message->currency; // PLN
// ... do stuff here. np zapis do bazy, etc.
});
// PHP7
$bmService->getHashFactory()->setAlgo(new class implements AlgoInterface {
public function hash($string)
{
return md5($string);
}
});
// PHP7
use BlueMediaConnector\Transport\TransportInterface;
$bmService->setTransport(new class implements TransportInterface {
public function parse($content)
{
return json_decode($content);
}
})
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.