PHPackages                             dotlines-io/ghoori-subscription - 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. dotlines-io/ghoori-subscription

ActiveLibrary

dotlines-io/ghoori-subscription
===============================

This package can be used for Subscription Payment integration with Ghoori Platform.

1.0.9(4y ago)043MITPHPPHP ^7.4|^8.0

Since May 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dotlines-io/ghoori-subscription)[ Packagist](https://packagist.org/packages/dotlines-io/ghoori-subscription)[ Docs](https://github.com/dotlines-io/ghoori-subscription)[ RSS](/packages/dotlines-io-ghoori-subscription/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (11)Used By (0)

Ghoori Subscription Composer Package
====================================

[](#ghoori-subscription-composer-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/054ea9565b831399bb7c08db1a7ad6defd74d635e38c35650843e9934053e0cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f746c696e65732d696f2f67686f6f72692d737562736372697074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dotlines-io/ghoori-subscription)[![Tests](https://github.com/dotlines-io/ghoori-subscription/actions/workflows/run-tests.yml/badge.svg)](https://github.com/dotlines-io/ghoori-subscription/actions/workflows/run-tests.yml)[![Psalm](https://github.com/dotlines-io/ghoori-subscription/actions/workflows/psalm.yml/badge.svg)](https://github.com/dotlines-io/ghoori-subscription/actions/workflows/psalm.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c61fde5b90783e849d6aab95708285e73a32f8022cb3c84914e4d9f8b45b79af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646f746c696e65732d696f2f67686f6f72692d737562736372697074696f6e2f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/dotlines-io/ghoori-subscription/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/bb9d84c0e86190726d7b6b65814a03ab39841b88f214a286534d8900514d57b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f746c696e65732d696f2f67686f6f72692d737562736372697074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dotlines-io/ghoori-subscription)[![Total Downloads](https://camo.githubusercontent.com/a98ebcd1d959effc8bfdaf1ba0ca688d8e8291ab48f35bb3e58645206dd00b12/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f646f746c696e65732d696f2f67686f6f72692d737562736372697074696f6e)](https://packagist.org/packages/dotlines-io/ghoori-subscription)

---

This composer package can be used for Subscription Payment integration with [Ghoori](http://ghoori.com.bd) Platform. For the credentials, please contact with  or call 8809612332215

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

[](#installation)

You can install the package via composer:

```
composer require dotlines-io/ghoori-subscription
```

Usage
-----

[](#usage)

```
/**
 * ******************************************************
 * ******************* Token Fetching *******************
 * *********** Contact Ghoori For Credentials ***********
 * ******************************************************
 */
$tokenUrl = 'https:///oauth/token';
$username = '';
$password = '';
$clientID = '';
$clientSecret = '';

$accessTokenRequest = \Dotlines\Ghoori\AccessTokenRequest::getInstance($tokenUrl, $username, $password, $clientID, $clientSecret);
$tokenResponse = $accessTokenRequest->send();
echo json_encode($tokenResponse) . '';

/**
 * Access Token Request Response looks like below:
 * {
 *  "token_type": "Bearer",
 *  "expires_in": 3600,
 *  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdW.....",
 *  "refresh_token": "def50200284b2371cad76b4d2a4e24746c44fd6a322....."
 * }
 */

/**
 * Access Token can be cached and reused for 1 hour
 * Before the end of accessToken lifetime every hour
 * you can use the refresh token to fetch new accessToken & refreshToken
 */
$accessToken = $tokenResponse['access_token'];
$refreshToken = $tokenResponse['refresh_token'];

/**
 * ******************************************************
 * ******************* Charge Request *******************
 * ******************************************************
 */
$subscriptionUrl = 'https:///api/v1.0/subscribe';
$requestID = ''; //must be unique for each request
$package = ''; //must be pre-registered with Ghoori
$cycle = ''; //possible values: DAILY, WEEKLY, FIFTEEN_DAYS, MONTHLY, THIRTY_DAYS, NINETY_DAYS, ONE_EIGHTY_DAYS
$start = ''; //Format: 2020-04-15
$end = ''; //Format: 2020-04-15
$userReturnUrl = ''; //after payment, user will be redirected back to this URL
$mobile = ''; //optional
$email = ''; //optional
$reference = ''; //optional
$subscriptionRequest = \Dotlines\GhooriSubscription\Request::getInstance($subscriptionUrl, $accessToken, $clientID, $requestID, $package, $cycle, $start, $end, $userReturnUrl, $mobile, $email, $reference);
echo json_encode($subscriptionRequest->send()) . '';

/**
 * Subscription Request Response looks like below.
 * You must redirect the user to the "url" for payment.
 * {
 *  "url": "https://gateway.sbsubscription.pay.bka.sh/gateway/web/intent/R2G2TXVM",
 *  "invoiceID": "QT5899212E8380",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Success"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ******** Subscription Request Status Request *********
 * ******************************************************
 */
$requestStatusRequestUrl = 'https:///api/v1.0/subscribe//status'; //replace SERVER_URL & invoiceID with value
$requestStatusRequest = \Dotlines\GhooriSubscription\RequestStatusRequest::getInstance($requestStatusRequestUrl, $accessToken);
echo json_encode($requestStatusRequest->send()) . '';

/**
 * Subscription Request Status Request Response looks like below:
 * {
 *  "invoiceID": "QT5899212E8380",
 *  "status": "SUCCEEDED",
 *  "subscriptionID": "414",
 *  "createdAt": "15-05-2021 04:10:21 PM",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ************ Subscription Details Request ************
 * ******************************************************
 */
$detailsRequestUrl = 'https:///api/v1.0/subscription/'; //replace SERVER_URL & subscriptionID with value
$detailsRequest = \Dotlines\GhooriSubscription\DetailsRequest::getInstance($detailsRequestUrl, $accessToken);
echo json_encode($detailsRequest->send()) . '';

/**
 * Subscription Details Request Response looks like below:
 * {
 *  "id": 414,
 *  "invoiceID": "QT5899212E8380",
 *  "amount": "25.00",
 *  "cycle": "WEEKLY",
 *  "enabled": "true",
 *  "createdDate": "2021-05-15",
 *  "startDate": "2021-06-22",
 *  "endDate": "2022-06-29",
 *  "requestID": "1272",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful",
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ************ Subscription Cancel Request ************
 * ******************************************************
 */
$cancelRequestUrl = 'https:///api/v1.0/subscription//cancel'; //replace SERVER_URL & subscriptionID with value
$cancelRequest = \Dotlines\GhooriSubscription\CancelRequest::getInstance($cancelRequestUrl, $accessToken);
echo json_encode($cancelRequest->send()) . '';

/**
 * Subscription Details Cancel Response looks like below:
 * {
 *  "id": 11,
 *  "subscriptionID": 19,
 *  "requestID": 11,
 *  "status": "PROCESSING",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ******** Subscription Cancel Details Request *********
 * ******************************************************
 */
$cancelDetailsRequestUrl = 'https:///api/v1.0/subscription/cancel/'; //replace SERVER_URL & id (cancel request id) with value
$cancelDetailsRequest = \Dotlines\GhooriSubscription\CancelDetailsRequest::getInstance($cancelDetailsRequestUrl, $accessToken);
echo json_encode($cancelDetailsRequest->send()) . '';

/**
 * Subscription Cancel Details Request Response looks like below:
 * {
 *  "id": 11,
 *  "subscriptionID": 19,
 *  "requestID": 11,
 *  "status": "PROCESSING",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ********* Subscription Payment List Request **********
 * ******************************************************
 */
$paymentListRequestUrl = 'https:///api/v1.0/subscription//payments'; //replace SERVER_URL & id (cancel request id) with value
$paymentListRequest = \Dotlines\GhooriSubscription\PaymentListRequest::getInstance($paymentListRequestUrl, $accessToken);
echo json_encode($paymentListRequest->send()) . '';

/**
 * Subscription Payment List Request Response looks like below:
 * {
 *  "subscriptionPayments": [
 *      {
 *          "paymentId": 17,
 *          "cycle": "DAILY",
 *          "dueDate": "2020-03-30",
 *          "reverseTransactionAmount": "0.00",
 *          "reverseTransactionDate": "",
 *          "reverseTransactionId": "",
 *          "status": "SUCCEEDED_PAYMENT",
 *          "subscriptionId": "22",
 *          "transactionDate": "2020-03-30T13:24:13.720768Z",
 *          "transactionId": "7CU901YXQP"
 *      },
 *      {
 *          "paymentId": 20,
 *          "cycle": "DAILY",
 *          "dueDate": "2020-03-31",
 *          "reverseTransactionAmount": "0.00",
 *          "reverseTransactionDate": "",
 *          "reverseTransactionId": "",
 *          "status": "SUCCEEDED_PAYMENT",
 *          "subscriptionId": "22",
 *          "transactionDate": "2020-03-31T06:00:52.885636Z",
 *          "transactionId": "7CV301YYUT"
 *      }
 *  ],
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ******** Subscription Payment Details Request ********
 * ******************************************************
 */
$paymentDetailsRequestUrl = 'https:///api/v1.0/subscription/payment/'; //replace SERVER_URL & id (paymentId) with value
$paymentDetailsRequest = \Dotlines\GhooriSubscription\PaymentDetailsRequest::getInstance($paymentDetailsRequestUrl, $accessToken);
echo json_encode($paymentDetailsRequest->send()) . '';

/**
 * Subscription Payment Details Request Response looks like below:
 * {
 *  "paymentId": 18,
 *  "cycle": "WEEKLY",
 *  "dueDate": "2020-03-30",
 *  "reverseTransactionAmount": "0.00",
 *  "reverseTransactionDate": "",
 *  "reverseTransactionId": "",
 *  "status": "SUCCEEDED_PAYMENT",
 *  "subscriptionId": "23",
 *  "transactionDate": "2020-03-30T13:29:04.741416Z",
 *  "transactionId": "7CU901YXQZ",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ******** Subscription Payment Refund Request ********
 * ******************************************************
 */
$paymentRefundRequestUrl = 'https:///api/v1.0/subscription/payment//refund'; //replace SERVER_URL & id (paymentId) with value
$refund_amount = 20;
$paymentRefundRequest = \Dotlines\GhooriSubscription\PaymentRefundRequest::getInstance($paymentRefundRequestUrl, $accessToken, $refund_amount);
echo json_encode($paymentRefundRequest->send()) . '';

/**
 * Subscription Payment Refund Request Response looks like below:
 * {
 *  "requestID": 4,
 *  "amount": "2",
 *  "status": "SUCCEEDED",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * **** Subscription Payment Refund Details Request *****
 * ******************************************************
 */
$paymentRefundDetailsRequestUrl = 'https:///api/v1.0/subscription/refund/'; //replace SERVER_URL & id (refund requestID) with value
$paymentRefundDetailsRequest = \Dotlines\GhooriSubscription\PaymentRefundDetailsRequest::getInstance($paymentRefundDetailsRequestUrl, $accessToken);
echo json_encode($paymentRefundDetailsRequest->send()) . '';

/**
 * Subscription Payment Refund Details Request Response looks like below:
 * {
 *  "requestID": 4,
 *  "amount": "2",
 *  "status": "SUCCEEDED",
 *  "errorCode": "00",
 *  "errorMessage": "Operation Successful"
 * }
 * Fail response only contains errorCode & errorMessage
 */

/**
 * ******************************************************
 * ******************* Refresh Token *******************
 * ******************************************************
 */
$refreshTokenRequest = \Dotlines\Ghoori\RefreshTokenRequest::getInstance($tokenUrl, $accessToken, $clientID, $clientSecret, $refreshToken);
$tokenResponse = $refreshTokenRequest->send();
echo json_encode($tokenResponse) . '';

/**
 * Refresh Token Request Response looks like below:
 * {
 *  "token_type": "Bearer",
 *  "expires_in": 3600,
 *  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdW.....",
 *  "refresh_token": "def50200284b2371cad76b4d2a4e24746c44fd6a322....."
 * }
 */
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [TareqMahbub](https://github.com/TareqMahbub)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 53.1% 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 ~0 days

Total

10

Last Release

1813d ago

PHP version history (2 changes)1.0.0PHP ^7.0

1.0.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/59867500f5299217fec76ab7e0b813ffcb1e63a4b197ba8f41dd49b2d4df48c3?d=identicon)[TareqMahbub](/maintainers/TareqMahbub)

---

Top Contributors

[![TareqMahbub](https://avatars.githubusercontent.com/u/1318776?v=4)](https://github.com/TareqMahbub "TareqMahbub (26 commits)")[![Mritunjoy71](https://avatars.githubusercontent.com/u/32269388?v=4)](https://github.com/Mritunjoy71 "Mritunjoy71 (14 commits)")[![afsara-ben](https://avatars.githubusercontent.com/u/44926095?v=4)](https://github.com/afsara-ben "afsara-ben (6 commits)")[![peash1068](https://avatars.githubusercontent.com/u/39594521?v=4)](https://github.com/peash1068 "peash1068 (3 commits)")

---

Tags

dotlines-iodotlinesghoori-subscription

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dotlines-io-ghoori-subscription/health.svg)

```
[![Health](https://phpackages.com/badges/dotlines-io-ghoori-subscription/health.svg)](https://phpackages.com/packages/dotlines-io-ghoori-subscription)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M344](/packages/tymon-jwt-auth)[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M719](/packages/statamic-cms)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)

PHPackages © 2026

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