PHPackages                             infinitypaul/laravel-cbs - 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. infinitypaul/laravel-cbs

ActiveLibrary[Payment Processing](/categories/payments)

infinitypaul/laravel-cbs
========================

A Laravel Package for working with central billing system seamlessly

0.0.5(6y ago)36082MITPHPPHP ^5.4.0|^7.0

Since Apr 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/infinitypaul/laravel-cbs)[ Packagist](https://packagist.org/packages/infinitypaul/laravel-cbs)[ Docs](https://github.com/infinitypaul/laravel-cbs)[ RSS](/packages/infinitypaul-laravel-cbs/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Central Billing System
======================

[](#central-billing-system)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d91f9ed970ee28863db12937cd179f50d4120eee8926ff69546c93c8838d8415/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e66696e6974797061756c2f6c61726176656c2d6362732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/infinitypaul/laravel-cbs)[![Build Status](https://camo.githubusercontent.com/6dad0a4bde8836564e0f897eae9aec9630356d467c704c1485c705c2c6455e54/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f696e66696e6974797061756c2f6c61726176656c2d6362732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/infinitypaul/laravel-cbs)[![Quality Score](https://camo.githubusercontent.com/3fdfb022e0cf425173437aebcc046fc1421d88f47cec8c90c769dd4e89f3d62f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f696e66696e6974797061756c2f6c61726176656c2d6362732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/infinitypaul/laravel-cbs)[![Total Downloads](https://camo.githubusercontent.com/3e445d88606d0c216ca10b1e12715dccdafcdf75f654d12dfa3b1a418f6d86f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e66696e6974797061756c2f6c61726176656c2d6362732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/infinitypaul/laravel-cbs)

A Laravel Package For Working With CBS (Central Billing System) Seamlessly

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

[](#installation)

You can install the package via composer:

```
composer require infinitypaul/laravel-cbs
```

> If you use **Laravel &gt;= 5.5** you can skip this step and go to [**`configuration`**](https://github.com/infinitypaul/laravel-cbs#configuration)

- `Infinitypaul\Cbs\CbsServiceProvider::class`

Also, register the Facade like so:

```
'aliases' => [
    ...
    'Cbs' => Infinitypaul\Cbs\Facades\Cbs::class,
    ...
]
```

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

[](#configuration)

You can publish the configuration file using this command:

```
php artisan vendor:publish --provider="Infinitypaul\Cbs\CbsServiceProvider"
```

A configuration-file named `cbs.php` with some sensible defaults will be placed in your `config` directory:

```
return [
    /**
     * Client ID From CBS
     *
     */
    'clientId' => getenv('CBS_CLIENT_ID'),

    /**
     * Secret Key From CBS
     *
     */
    'secret' => getenv('CBS_SECRET'),

    /**
     * switch to live or test
     *
     */
    'mode' => getenv('CBS_MODE', 'test'),

    /**
     * CBS Test Payment URL
     *
     */
    'testUrl' => getenv('CBS_TEST_BASE_URL'),

    /**
     * CBS Live Payment URL
     *
     */
    'liveURL' => getenv('CBS_LIVE_BASE_URL'),

    /**
     * Revenue Head
     *
     */
    'revenueHead' => getenv('CBS_REVENUE_HEAD'),

    /**
     * Revenue Head
     *
     */
    'categoryId' => getenv('CBS_CATEGORY_ID'),
];
```

Usage
-----

[](#usage)

Open your .env file and add your cbs key, cbs secret key, cbs revenue head, category id, live url , and test url like so:

```
CBS_CLIENT_ID=****
CBS_SECRET=****
CBS_REVENUE_HEAD=***
CBS_CATEGORY_ID=***
CBS_LIVE_BASE_URL=***
CBS_TEST_BASE_URL=***
```

Set up routes and controller methods like so:

```
// Laravel 5.1.17 and above
Route::post('/pay', 'InvoiceController@redirectToGateway')->name('pay');
```

OR

```
Route::post('/pay', [
    'uses' => 'InvoiceController@redirectToGateway',
    'as' => 'pay'
]);

Route::post('/pay2', [
    'uses' => 'InvoiceController@getInvoice',
    'as' => 'data'
]);
```

```
Route::get('/payment/callback', 'InvoiceController@handleGatewayCallback')->name('callback');
```

OR

```
// Laravel 5.0
Route::get('payment/callback', [
    'uses' => 'InvoiceController@handleGatewayCallback'
]);
```

```
