PHPackages                             phpawcom/thawani-php-class - 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. phpawcom/thawani-php-class

Abandoned → [phpawcom/thawani\_laravel](/?search=phpawcom%2Fthawani_laravel)Library

phpawcom/thawani-php-class
==========================

This class to help with the integration with Thawani Gateway (V2.0)

2.0.2(2y ago)2924↑66.7%2[1 PRs](https://github.com/phpawcom/thawani-php-class/pulls)MITPHPPHP &gt;=7.1

Since Jan 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/phpawcom/thawani-php-class)[ Packagist](https://packagist.org/packages/phpawcom/thawani-php-class)[ RSS](/packages/phpawcom-thawani-php-class/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (8)Used By (0)

Thawani PHP Class
-----------------

[](#thawani-php-class)

This class to help with the integration with Thawani Gateway (V2.0). You can find more about how to use it by [clicking here](https://www.s4d.om/g/e)

How to install
--------------

[](#how-to-install)

You can use composer:

`composer require phpawcom/thawani-php-class`

or clone the class using GIT:

```
git clone https://github.com/phpawcom/thawani-php-class.git

```

or Download the archive by [clicking here](https://github.com/phpawcom/thawani-php-class/archive/master.zip).

Usage
-----

[](#usage)

### Call the class:

[](#call-the-class)

```
// include_once(__DIR__.'/thawani.php'); || you don't need this if you are using composer autoload
$thawani = new \s4d\payment\thawani([
  'isTestMode' => 1, ## set it to 0 to use the class in production mode
  'public_key' => 'HGvTMLDssJghr9tlN9gr4DVYt0qyBy',
  'private_key' => 'rRQ26GcsZzoEhbrP2HZvLYDbn9C9et',
]);
```

### Generate Payment URL:

[](#generate-payment-url)

```
$url = $thawani->generatePaymentUrl([
  'client_reference_id' => rand(1000, 9999).$orderId, ## generating random 4 digits prefix to make sure there will be no duplicate ID error
  'products' => [
     ['name' => 'test test test test test test test test test test test test ', 'unit_amount' => 100, 'quantity' => 1],
     ['name' => 'test', 'unit_amount' => 100, 'quantity' => 1],
   ],
  'success_url' => $thawani->currentPageUrl().'?op=checkPayment', ## Put the link to next a page with the method checkPaymentStatus()
  'cancel_url' => $thawani->currentPageUrl().'?op=checkPayment',
  'metadata' => [
                'order_id' => $orderId,
                'customer_name' => 'Fulan Al Fulani',
                'customer_phone' => '90000000',
                'customer_email' => 'email@domain.tld'
   ]
 ]);
 if(!empty($url)){
  ## method will provide you with a payment id from Thawani, you should save it to your order. You can get it using this: $thawani->payment_id
  ## header('location: '.$url); ## Redirect to payment page
  $_SESSION['session_id'] = $thawani->payment_id; ## save session_id to use to check payment status later
  echo 'Click to Pay';
}
```

### Check Payment Status:

[](#check-payment-status)

```
$check = $thawani->checkPaymentStatus($_SESSION['session_id']);
if($thawani->payment_status == 1){
  ## successful payment
  echo 'successful payment';
}else{
  ## failed payment
  echo 'payment failed';
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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 ~192 days

Recently: every ~113 days

Total

7

Last Release

787d ago

Major Versions

V1.2.4 → V2.0.02023-02-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/999ec08cdb0e9da4b7702cb5162cd9626e05a73f0d70e54b1dd47a36f9b123ca?d=identicon)[s4d](/maintainers/s4d)

---

Top Contributors

[![phpawcom-shared](https://avatars.githubusercontent.com/u/184776161?v=4)](https://github.com/phpawcom-shared "phpawcom-shared (15 commits)")

### Embed Badge

![Health badge](/badges/phpawcom-thawani-php-class/health.svg)

```
[![Health](https://phpackages.com/badges/phpawcom-thawani-php-class/health.svg)](https://phpackages.com/packages/phpawcom-thawani-php-class)
```

PHPackages © 2026

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