1. Go to this page and download the library: Download haithemdev/flouci-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/ */
haithemdev / flouci-bundle example snippets
use Flouci\SymfonyBundle\Service\FlouciServiceInterface;
public function checkout(FlouciServiceInterface $flouci)
{
$result = $flouci->generatePaymentLink(
10.500, // Amount in TND
'order_123',
'https://your-app.com/success',
'https://your-app.com/fail'
);
return $this->redirect($result['link']);
}
use Flouci\SymfonyBundle\Event\FlouciEvents;
use Flouci\SymfonyBundle\Event\PaymentVerifiedEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: FlouciEvents::PAYMENT_VERIFIED)]
public function onPaymentVerified(PaymentVerifiedEvent $event): void
{
$data = $event->getPaymentData();
$orderId = $event->getTrackingId();
if ($event->getStatus() === 'SUCCESS') {
// Update your order in database
}
}
use Flouci\SymfonyBundle\Service\FlouciManager;
public function pay(Client $client, FlouciManager $manager)
{
// Automatically uses default if $client keys are null, or creates a new service if they exist.
$flouci = $manager->getService($client->getToken(), $client->getSecret());
$flouci->generatePaymentLink(...);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.