PHPackages                             souidev/laravel-clictopay - 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. souidev/laravel-clictopay

ActiveLibrary[Payment Processing](/categories/payments)

souidev/laravel-clictopay
=========================

Laravel integration for ClicToPay payment gateway

134[3 PRs](https://github.com/souidev/laravel-clictopay/pulls)PHPCI passing

Since Oct 13Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/souidev/laravel-clictopay)[ Packagist](https://packagist.org/packages/souidev/laravel-clictopay)[ RSS](/packages/souidev-laravel-clictopay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (4)Used By (0)

Laravel ClicToPay Integration Package
=====================================

[](#laravel-clictopay-integration-package)

This package simplifies the integration of the ClicToPay payment gateway into your Laravel applications.

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

[](#installation)

1. **Install the package via Composer:**

    ```
    composer require Souidev/laravel-clictopay
    ```

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

[](#configuration)

1. **Publish the configuration file:**

    ```
    php artisan vendor:publish --provider="Souidev\ClicToPayLaravel\ClicToPayLaravelServiceProvider" --tag="config"
    ```
2. **Configure your ClicToPay credentials:**

    - Edit the `config/clictopay.php` file. It's recommended to use environment variables for sensitive information:

        ```
        // config/clictopay.php
        return [
            'username' => env('CLICTOPAY_USERNAME'),
            'password' => env('CLICTOPAY_PASSWORD'),
            'test_mode' => env('CLICTOPAY_TEST_MODE', true),
            'return_url' => env('CLICTOPAY_RETURN_URL'),
            'fail_url' => env('CLICTOPAY_FAIL_URL'),
            'api_base_url' => env('CLICTOPAY_API_BASE_URL', '[https://test.clictopay.com/payment/rest/](https://test.clictopay.com/payment/rest/)'), // Default test URL
        ];
        ```
    - Set the corresponding environment variables in your `.env` file:

        ```
        CLICTOPAY_USERNAME=your_username
        CLICTOPAY_PASSWORD=your_password
        CLICTOPAY_TEST_MODE=true  # or false
        CLICTOPAY_RETURN_URL=https://your-site.com/payment/success
        CLICTOPAY_FAIL_URL=https://your-site.com/payment/fail

        ```

Usage
-----

[](#usage)

1. **Use the `ClicToPay` facade to interact with the ClicToPay API:**

    ```
    use Souidev\ClicToPayLaravel\Facades\ClicToPay;

    try {
        // Register a payment with optional parameters
        $paymentDetails = ClicToPay::registerPayment([
            // Required parameters
            'orderNumber' => 'ORDER-12345',
            'amount' => 10000, // in cents
            'currency' => 788, // Currency code (788 for TND)

            // Optional parameters
            'language' => 'fr',           // fr, en, ar
            'pageView' => 'DESKTOP',      // DESKTOP or MOBILE
            'orderDescription' => 'Payment for order #12345',
            'expirationDate' => '2024-12-31T23:59:59', // ISO 8601
            'jsonParams' => json_encode([
                'email' => 'customer@example.com',  // Required if merchant notifications are enabled
                'orderNumber' => '1234567890',      // Your internal order reference
                // Add any additional parameters needed for bank processing
            ])
        ]);

        // Redirect user to ClicToPay payment page
        return redirect()->away($paymentDetails['formUrl']);

    } catch (\Exception $e) {
        return back()->with('error', $e->getMessage());
    }
    ```
2. **Check payment status:**

    ```
    try {
        $status = ClicToPay::getPaymentStatus([
            'orderId' => 'ORDER-12345',
            'language' => 'fr' // Optional - for localized error messages
        ]);

        // Handle the response
        if ($status['ErrorCode'] === '0') { // No system error
            // Process the payment status
            $orderStatus = $status['OrderStatus'];
            // Possible values in $orderStatus:
            // - 0: Order registered but not paid
            // - 1: Order pre-authorized
            // - 2: Order paid
            // - 3: Authorization canceled
            // - 4: Transaction canceled
            // - 5: Authorization on hold
            // - 6: Refund
        }
    } catch (\Exception $e) {
        // Handle error
    }
    ```
3. **Get extended order status:**

    ```
    try {
        $extendedStatus = ClicToPay::getExtendedOrderStatus([
            'orderId' => 'ORDER-12345',
            'language' => 'fr' // Optional - for localized error messages
        ]);

        // Handle extended status information
        if ($extendedStatus['ErrorCode'] === '0') {
            // Access additional payment information
            $orderStatus = $extendedStatus['orderStatus'];
            $amount = $extendedStatus['amount'];
            $currency = $extendedStatus['currency'];
            $date = $extendedStatus['date'];
            // ... other available fields
        }
    } catch (\Exception $e) {
        // Handle error
    }
    ```

The package automatically handles test/live mode based on your configuration:

- Test mode: Set `CLICTOPAY_TEST_MODE=true` in your `.env` file (uses `https://test.clictopay.com/payment/rest/`)
- Production mode: Set `CLICTOPAY_TEST_MODE=false` (uses `https://clictopay.com/payment/rest/` or other provided URL)

**Note:** When customer notification is enabled for your merchant account, you must include the customer's email address in the `jsonParams` field as shown in the example above.

Available Methods
-----------------

[](#available-methods)

Refer to the `ClicToPayService` class for available methods. Here's a quick overview:

- `registerPayment(array $params)`: Registers a new payment.
- `registerPreAuth(array $params)`: Registers a pre-authorization.
- `confirmPayment(array $params)`: Confirms a pre-authorized payment.
- `cancelPayment(array $params)`: Cancels a payment.
- `refundPayment(array $params)`: Refunds a payment.
- `getPaymentStatus(array $params)`: Retrieves the status of a payment.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](https://github.com/souidev/laravel-clictopay/blob/main/CONTRIBUTING.md) for details.

License
-------

[](#license)

[MIT License](https://github.com/souidev/laravel-clictopay/blob/main/LICENSE.md)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance59

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/35b2310a066102b83eff580f0c17d9479c29251202cfea1c43080a8872f2c2ca?d=identicon)[souidev](/maintainers/souidev)

---

Top Contributors

[![souidev](https://avatars.githubusercontent.com/u/12151478?v=4)](https://github.com/souidev "souidev (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

### Embed Badge

![Health badge](/badges/souidev-laravel-clictopay/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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