PHPackages                             lotuashvili/laravel-tbcpay - 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. lotuashvili/laravel-tbcpay

AbandonedArchivedLibrary

lotuashvili/laravel-tbcpay
==========================

TBC Payment for Laravel

v1.2.0(3y ago)481.1k4PHPPHP ^7.1|^8.0|^8.1

Since May 28Pushed 3y ago5 watchersCompare

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

READMEChangelogDependencies (2)Versions (8)Used By (0)

Laravel TbcPay
==============

[](#laravel-tbcpay)

[![Latest Stable Version](https://camo.githubusercontent.com/3ca166cef8f09a8487d83d852c3bdf6e582667960b77fa12a5a937c481806374/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f747561736876696c692f6c61726176656c2d7462637061792e737667)](https://packagist.org/packages/lotuashvili/laravel-tbcpay)[![Total Downloads](https://camo.githubusercontent.com/1e7ffc72fdb704105bb7169969d28853e5d094b1fb7b2dd1897f7dd11489c7ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f747561736876696c692f6c61726176656c2d7462637061792e737667)](https://packagist.org/packages/lotuashvili/laravel-tbcpay)[![Downloads Month](https://camo.githubusercontent.com/41c59b2a7d98b7b573d906fffd86b86faa6570af3e90ab2078c50671dea2f6bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c6f747561736876696c692f6c61726176656c2d7462637061792e737667)](https://packagist.org/packages/lotuashvili/laravel-tbcpay)

This package allows you to use TBC payments in your Laravel application.

[![Laravel TbcPay](cover.png)](cover.png)

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

[](#table-of-contents)

- [Installation](#installation)
- [Transaction types](#transaction-types-sms--dms)
- [Generating and placing a certificate](#generating-and-placing-a-certificate)
- [Environment](#environment)
- [Configuration](#configuration)
    - [Amount Unit](#amount-unit)
    - [Merchant URLs](#merchant-urls)
    - [Debug](#debug)
- [Usage](#usage)
    - [Routes and Controller](#setting-up-routes-and-controller)
    - [Payment](#payment)
    - [Other methods](#using-other-methods)
    - [Closing day with cron](#closing-day-with-cron)
- [Transactions History](#transactions-history)
- [Result Codes](#result-codes)
- [Credits](#credits)

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

[](#installation)

```
composer require lotuashvili/laravel-tbcpay

```

#### For Laravel &lt;= 5.4

[](#for-laravel--54)

If you're using Laravel 5.4 or lower, you have to manually add a service provider in your `config/app.php` file. Open `config/app.php` and add `TbcPayServiceProvider` to the `providers` array.

```
'providers' => [
    # Other providers
    Lotuashvili\LaravelTbcPay\TbcPayServiceProvider::class,
],
```

Then run:

```
php artisan vendor:publish --provider="Lotuashvili\LaravelTbcPay\TbcPayServiceProvider"

```

And run migrations:

```
php artisan migrate

```

Transaction types (SMS / DMS)
-----------------------------

[](#transaction-types-sms--dms)

There are two types of transaction within this system: **SMS** and **DMS**.

SMS - is a direct payment method, money is charged in 1 event, as soon as customer enters the credit card details and clicks proceed.
DMS - is a two step method, first event blocks the money on the card (max 30 days), second event captures the money (second event can be carried out when product is shipped to the customer for example).

Every 24 hours, a merchant must close the business day.

Generating and placing a certificate
------------------------------------

[](#generating-and-placing-a-certificate)

TBC provides SSL certificate in **.p12** format, we need to transform it to **.pem** format. Use command below:

```
openssl pkcs12 -in *.p12 -out tbcpay.pem

```

After transformation, place certificate (**.pem** file) in `storage/certificates` folder. Name it whatever you want (tbcpay.pem in this example) and specify the name and password in `.env`.

```
TBCPAY_CERTIFICATE_NAME=tbcpay.pem
TBCPAY_CERTIFICATE_PASS=YourPassword123

```

After that, add `storage/certificates` folder in to your `.gitignore`.

Environment
-----------

[](#environment)

Set your environment variables:

**Note:** Specify only certificate file name instead of full path. Certificates are placed in `storage/certificates` folder.

Set default currency with ISO 4217 standart. List of all currencies: [http://en.wikipedia.org/wiki/ISO\_4217](http://en.wikipedia.org/wiki/ISO_4217) (Default is 981 - GEL).

```
TBCPAY_DEBUG=true
TBCPAY_CERTIFICATE_NAME=tbcpay.pem
TBCPAY_CERTIFICATE_PASS=YourPassword123
TBCPAY_DEFAULT_CURRENCY=981

```

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

[](#configuration)

#### Amount unit

[](#amount-unit)

You can change default amount unit from configuration or `.env` file. Amount unit is used to multiply final amount before sending request to TBC. TBC bank requires amount in Cents (or Tetri) instead of USD (or GEL).

By default, unit is set to 100, so you can pass amount in GEL, for example `$amount = 300` will redirect to the checkout page with `300GEL` amount.

If you set unit to `1`, then you will be redirected to the checkout page with `3GEL` amount.

To change amount unit, set `TBCPAY_AMOUNT_UNIT=1` in `.env` file or change `amount_unit` directly in `config/tbc.php`.

#### Merchant URLs

[](#merchant-urls)

If one day TBC updates merchant and submit URLs, you can simply override old URLs from `.env` or `config/tbc.php`.

Set `TBCPAY_MERCHANT_URL` and `TBCPAY_FORM_URL` in `.env` or `merchant_url` and `form_url` directly in `config/tbc.php`.

#### Debug

[](#debug)

Simply enable debug from `.env` by setting `TBCPAY_DEBUG=true`, all logs will be in `tbc_logs` table by default. You can access them with `Lotuashvili\LaravelTbcPay\Models\TbcLog` model.

Usage
-----

[](#usage)

### Setting up routes and controller

[](#setting-up-routes-and-controller)

After publishing files, `app/Http/Controllers/TbcPayController` will be created. Feel free to modify controller as you want.

Open `routes/web.php` and define routes (Remove variables to use default values).

```
