PHPackages                             granada-pride/clickpaysa - 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. granada-pride/clickpaysa

ActiveLibrary[Payment Processing](/categories/payments)

granada-pride/clickpaysa
========================

Clickpaysa Payment Gateway Integration with Laravel Framework

v2.1.4(1y ago)1351MITPHP

Since Aug 18Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/hussaingaber/laravel-clickpaysa)[ Packagist](https://packagist.org/packages/granada-pride/clickpaysa)[ RSS](/packages/granada-pride-clickpaysa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (13)Used By (0)

![Github All Releases](https://camo.githubusercontent.com/01e98eebda00cb2baa63ddc28623ff38f2d0042bb64f893a96d7a3bd59b5e380/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6772616e6164612d70726964652f636c69636b7061797361)

Clickpaysa Payment Gateway Integration for Laravel
==================================================

[](#clickpaysa-payment-gateway-integration-for-laravel)

Table of Contents
-----------------

[](#table-of-contents)

1. [Description](#description)
2. [Installation](#installation)
3. [Configuration](#configuration)
4. [Usage](#usage)
    - [Creating a PayPage](#create-paypage)
    - [Querying Transactions](#query-transaction)
    - [Capturing a Payment](#capturing-a-payment)
    - [Refunding a Payment](#refunding-a-payment)
    - [Voiding a Payment](#voiding-a-payment)
5. [Troubleshooting](#troubleshooting)
6. [Testing](#testing)
7. [Contribution](#contribution)
8. [License](#license)

Description
-----------

[](#description)

The `laravel-clickpaysa` package provides an easy way to integrate the Clickpaysa payment gateway into your Laravel applications. This package adheres to SOLID principles and uses modern PHP practices, ensuring your code is maintainable, testable, and scalable.

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

[](#installation)

You can install the package via composer:

```
composer require granada-pride/clickpaysa
```

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

[](#configuration)

After installation, publish the configuration file using the following command:

```
php artisan vendor:publish --provider="GranadaPride\Clickpay\ClickpayServiceProvider"
```

This will create a `config/clickpay.php` file. Here is an example of what the configuration file might look like:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Clickpay Profile ID
    |--------------------------------------------------------------------------
    |
    | This is your Clickpay profile ID, which is required for making API
    | requests. Ensure that this value is provided in your environment
    | configuration file (.env).
    |
    */

    'profile_id' => env('CLICKPAY_PROFILE_ID'),

    /*
    |--------------------------------------------------------------------------
    | Clickpay Server Key
    |--------------------------------------------------------------------------
    |
    | Your Clickpay server key is used to authenticate API requests. Make
    | sure to keep this value secure and do not expose it in your version
    | control system. It should be stored in the .env file.
    |
    */

    'server_key' => env('CLICKPAY_SERVER_KEY'),

    /*
    |--------------------------------------------------------------------------
    | Default Currency
    |--------------------------------------------------------------------------
    |
    | The currency in which payments will be processed by default. You can
    | change this to any currency supported by Clickpay (e.g., USD, EUR).
    | This value can also be configured in your .env file.
    |
    */

    'currency' => env('CLICKPAY_CURRENCY', 'SAR'),

    /*
    |--------------------------------------------------------------------------
    | Clickpay API Base URL
    |--------------------------------------------------------------------------
    |
    | The base URL for the Clickpay API. This is typically the endpoint where
    | API requests are sent. You can change this value if Clickpay provides
    | a different URL for specific regions or environments (e.g., testing).
    |
    */

    'base_url' => env('CLICKPAY_BASE_URL', 'https://secure.clickpay.com.sa'),

];
```

Environment Variables
---------------------

[](#environment-variables)

Make sure to set the required environment variables in your `.env` file:

```
CLICKPAY_PROFILE_ID=your_profile_id
CLICKPAY_SERVER_KEY=your_server_key
CLICKPAY_CURRENCY=SAR
CLICKPAY_BASE_URL=https://secure.clickpay.com.sa
```

Usage
-----

[](#usage)

### Creating a PayPage

[](#creating-a-paypage)

Here's how to create a payment page using this package:

```
use GranadaPride\Clickpay\ClickpayClient;
use GranadaPride\Clickpay\DTO\CustomerDTO;
use GranadaPride\Clickpay\DTO\PaymentDTO;
use GranadaPride\Clickpay\Contracts\PaymentGatewayInterface;

$clickpay = app(PaymentGatewayInterface::class);

// Set CustomerDTO Information using the CustomerDTO DTO
$customerDTO = new CustomerDTO(
    name: 'Ahmad Mohamed',
    phone: '+123456789',
    email: 'ahmad_mohamed@example.com',
    street: '123 Main St',
    city: 'Cityville',
    state: 'Stateland',
    country: 'KSA',
    zipCode: '12345'
);

// Use CustomerDTO Information for Shipping if it's the same
$shippingDTO = $customerDTO;

// Set PaymentDTO Details
$paymentDTO = new PaymentDTO(
    cartId: 'CART123',
    cartAmount: 150.00,
    cartDescription: 'Sample Cart Description',
    customerDTO: $customerDTO,
    shippingDTO: $shippingDTO,
    callbackUrl: 'https://yourdomain.com/callback',
    returnUrl: 'https://yourdomain.com/return',
    paypageLang: 'ar',
    hideShipping: false  // Set to true if you want to hide shipping details on the payment page
);

// Or you can simply send only required data
$paymentDTO = new PaymentDTO(
    cartId: 'CART123',
    cartAmount: 150.00,
    cartDescription: 'Sample Cart Description',
    callbackUrl: 'https://yourdomain.com/callback',
    returnUrl: 'https://yourdomain.com/return',
    paypageLang: 'ar',
    hideShipping: false  // Set to true if you want to hide shipping details on the payment page
);

// Generate PaymentDTO Page
$response = $clickpay->createPaymentPage($paymentDTO);

dd($response);
```

### Querying Transactions

[](#querying-transactions)

You can also query a transaction using its reference:

```
use GranadaPride\Clickpay\Contracts\PaymentGatewayInterface;

$clickpay = app(PaymentGatewayInterface::class);

$response = $clickpay->queryTransaction('TST2422201903602');

dd($response);
```

### Capturing a Payment

[](#capturing-a-payment)

The `capturePayment` method allows you to capture a previously authorized transaction. This is typically used when a payment is authorized at the time of order placement, but you only want to capture the funds when the goods are shipped.

**Example:**

```
use GranadaPride\Clickpay\Contracts\PaymentGatewayInterface;

$clickpay = app(PaymentGatewayInterface::class);

$response = $clickpay->capturePayment(
    transactionReference: 'TST2112600164150',
    amount: 1.3,
    currency: 'SAR',
    cartId: 'cart_66666',
    cartDescription: 'Capture reason'
);

dd($response);
```

### Refunding a Payment

[](#refunding-a-payment)

The `refundPayment` method is used to refund a previously completed transaction. This can be useful when a customer requests a refund for their order.

**Example:**

```
use GranadaPride\Clickpay\Contracts\PaymentGatewayInterface;

$clickpay = app(PaymentGatewayInterface::class);

$response = $clickpay->refundPayment(
    transactionReference: 'TST2016700000692',
    amount: 1.3,
    currency: 'SAR',
    cartId: 'cart_66666',
    cartDescription: 'Refund reason'
);

dd($response);
```

### Voiding a Payment

[](#voiding-a-payment)

The `voidPayment` method allows you to void a previously authorized or captured transaction. This is typically used when an order is canceled before it is fulfilled.

**Example:**

```
use GranadaPride\Clickpay\ClickpayClient;
use GranadaPride\Clickpay\Contracts\PaymentGatewayInterface;

$clickpay = app(PaymentGatewayInterface::class);

$response = $clickpay->voidPayment(
    transactionReference: 'TST2016700000692',
    amount: 1.3,
    currency: 'SAR',
    cartId: 'cart_66666',
    cartDescription: 'Void reason'
);

dd($response);
```

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

- **Invalid Credentials:** Ensure that your `profile_id` and `server_key` in the configuration file are correct.
- **Unsupported Region:** Double-check that the `base_url` in your configuration file is valid and supported by Clickpay.
- **Transaction Failure:** Verify the transaction data (e.g., cart amount, customer details) to ensure it meets Clickpay's requirements.

If you encounter other issues, refer to the [Clickpay API Documentation](https://secure.clickpay.com.sa) for more details.

Testing
-------

[](#testing)

Soon...

Contribution
------------

[](#contribution)

Contributions are welcome! If you’d like to contribute to this package, please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Write your code and ensure it is well-documented.
4. Submit a pull request with a clear description of your changes.

License
-------

[](#license)

This package is open-source software licensed under the MIT License. Please see the `License` File for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance49

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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

Every ~1 days

Total

12

Last Release

616d ago

Major Versions

v1.1.0 → v2.0.02024-08-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/09be670590cd3bf1e47a2a37c816ed67d0dab19b683f740b3df531649e35e330?d=identicon)[husseingaber](/maintainers/husseingaber)

---

Top Contributors

[![blue-elephant-tech](https://avatars.githubusercontent.com/u/148823784?v=4)](https://github.com/blue-elephant-tech "blue-elephant-tech (15 commits)")

---

Tags

clickpaylaravel-clickpaylaravel-packagepayment-gateway

### Embed Badge

![Health badge](/badges/granada-pride-clickpaysa/health.svg)

```
[![Health](https://phpackages.com/badges/granada-pride-clickpaysa/health.svg)](https://phpackages.com/packages/granada-pride-clickpaysa)
```

###  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)
