1. Go to this page and download the library: Download arturwwl/przelewy24-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/ */
arturwwl / przelewy24-bundle example snippets
// ...
class AppKernel extends Kernel
// ...
public function registerBundles()
{
$bundles = [
// ...
new Arturwwl\Przelewy24Bundle\ArturwwlPrzelewy24Bundle(),
// ...
];
}
// ...
use Arturwwl\Przelewy24Bundle\Factory\ProcessFactory;
use Arturwwl\Przelewy24Bundle\Model\Payment;
// ...
class AppController extends Controller
{
// ...
public function processAction(ProcessFactory $processFactory)
{
$order = // ... - You are creating your order here
$payment = new Payment();
$payment
->setCurrency('PLN')
->setSessionId($order->geToken()) //VERY IMPORTANT some unique id from your order in your db
->setAmount($order->getAmount())
->setDescription($order->getDesc())
->setEmail($order->getEmail())
->setReturnUrl($this->generateUrl('return', [], 0)); // use following syntax to genreate absolute url
$processFactory->setPayment($payment);
$url = $processFactory->createAndGetUrl();
return $this->redirect($url);
}
// ...
}
namespace AppBundle\EventListener\Przelewy24;
use Arturwwl\Przelewy24Bundle\Event\PaymentEventInterface;
class PaymentSuccessListener
{
// ..
public function onPrzelewy24EventPaymentSuccess(PaymentEventInterface $event)
{
$token = $event->getPayment()->getSessionId();
// ..
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.