PHPackages                             haithemdev/clictopay-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. haithemdev/clictopay-bundle

ActiveSymfony-bundle[Payment Processing](/categories/payments)

haithemdev/clictopay-bundle
===========================

Ready-to-use Symfony Bundle for ClicToPay (SMT Tunisia) Payment Gateway. Supports multi-account, event-driven architecture, and built-in webhook handling.

v1.0.0(3mo ago)00MITPHPPHP &gt;=8.1CI passing

Since Apr 3Pushed 3mo agoCompare

[ Source](https://github.com/haithemdev/clictopay-bundle)[ Packagist](https://packagist.org/packages/haithemdev/clictopay-bundle)[ RSS](/packages/haithemdev-clictopay-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

ClicToPay Symfony Bundle
========================

[](#clictopay-symfony-bundle)

[![Tests](https://github.com/haithemdev/clictopay-bundle/actions/workflows/tests.yml/badge.svg)](https://github.com/haithemdev/clictopay-bundle/actions)[![Latest Stable Version](https://camo.githubusercontent.com/6789f0036e862cabd0aba47cc51be817ab9cbbba68c0c53ac71937354686ab56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6861697468656d6465762f636c6963746f7061792d62756e646c652e737667)](https://packagist.org/packages/haithemdev/clictopay-bundle)[![License](https://camo.githubusercontent.com/fadfe1b4d9e032f007382683583b21d82027f226fd953dec2674a5b0aa08296b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6861697468656d6465762f636c6963746f7061792d62756e646c652e737667)](https://github.com/haithemdev/clictopay-bundle/blob/main/LICENSE)

A reusable Symfony bundle for integrating the **ClicToPay (SMT Tunisia)** payment gateway.

Features
--------

[](#features)

- ✅ **Direct API Integration**: Handles `register.do` and `getOrderStatus.do`.
- ✅ **Event-Driven Architecture**: Like modern Symfony bundles, it dispatches events for clean code decoupling (`ClicToPayEvents::PAYMENT_VERIFIED`).
- ✅ **Multi-Account / Multi-Tenant**: Supports having different API keys for different clients dynamically.
- ✅ **Built-in Webhook Controller**: Ready-to-use webhook route to verify payments.
- ✅ **TND Decimal Support**: Automatically converts amounts to millimes (subunits).

Installation
------------

[](#installation)

```
composer require haithemdev/clictopay-bundle
```

*(Note: Once published on Packagist. Until then, use a local path repository).*

Configuration
-------------

[](#configuration)

### Mode Simple (Standard)

[](#mode-simple-standard)

Create a `config/packages/clic_to_pay.yaml` file:

```
clic_to_pay:
    mode: '%env(CLICTOPAY_MODE)%' # 'test' or 'prod'
    user_name: '%env(CLICTOPAY_USER_NAME)%'
    password: '%env(CLICTOPAY_PASSWORD)%'
```

### Mode Avancé (Multiple Accounts)

[](#mode-avancé-multiple-accounts)

```
clic_to_pay:
    accounts:
        main:
            user_name: '...'
            password: '...'
            mode: 'prod'
        sandbox:
            user_name: '...'
            password: '...'
            mode: 'test'
```

And update your `.env`:

```
CLICTOPAY_MODE=test
CLICTOPAY_USER_NAME=your_api_username
CLICTOPAY_PASSWORD=your_api_password
```

Usage
-----

[](#usage)

### 1. Generate a Payment URL

[](#1-generate-a-payment-url)

In your controller, use the `ClicToPayManager` to register a payment and get the redirection URL.

```
use Hdev\ClicToPayBundle\Service\ClicToPayManager;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @Route("/checkout/payment", name="app_payment")
 */
public function pay(ClicToPayManager $manager)
{
    $service = $manager->getDefault(); // or $manager->get('sandbox')

    $response = $service->registerPayment(
        'ORD-12345',
        150.500, // TND
        $this->generateUrl('app_payment_confirm', [], UrlGeneratorInterface::ABSOLUTE_URL)
    );

    // Redirect the user to ClicToPay secure page
    return $this->redirect($response['formUrl']);
}
```

### 2. Handling Payments (Events)

[](#2-handling-payments-events)

Create a listener to handle successful payments cleanly:

```
use Hdev\ClicToPayBundle\Event\ClicToPayEvents;
use Hdev\ClicToPayBundle\Event\PaymentVerifiedEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener(event: ClicToPayEvents::PAYMENT_VERIFIED)]
public function onPaymentVerified(PaymentVerifiedEvent $event): void
{
    // ClicToPay OrderStatus = 2 means Approved
    if ($event->isApproved()) {
        $orderId = $event->getCtpOrderId();
        $details = $event->getPaymentData();

        // Update your order in database!
    }
}
```

### 3. Built-in Webhook

[](#3-built-in-webhook)

The bundle includes a ready-to-use controller. You can give this link to your clients or use it directly as your `returnUrl`:

```
https://your-app.com/clictopay/webhook/default

```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

License
-------

[](#license)

MIT

About
-----

[](#about)

Ready-to-use Symfony Bundle for ClicToPay (SMT Tunisia) Payment Gateway. Optimized for multi-account and client-specific integrations with event-driven architecture.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

93d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43a4df5b0b5474e44ddedbb0914282481cc356aa399e23dc3b832f2d7421cd85?d=identicon)[haithemdev](/maintainers/haithemdev)

---

Top Contributors

[![millesima-dev](https://avatars.githubusercontent.com/u/162648461?v=4)](https://github.com/millesima-dev "millesima-dev (7 commits)")

---

Tags

symfonybundlepaymentgatewaysmtclictopaytunisia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/haithemdev-clictopay-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/haithemdev-clictopay-bundle/health.svg)](https://phpackages.com/packages/haithemdev-clictopay-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M204](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M577](/packages/shopware-core)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
