PHPackages                             wearede/tbcpay-php - 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. wearede/tbcpay-php

ActiveLibrary

wearede/tbcpay-php
==================

online payments php SDK - collect credit card payments via TbcBank processor

0.12.0(4y ago)904.6k↓50%30[1 PRs](https://github.com/wearede/tbcpay-php/pulls)1MITPHPPHP &gt;=5.4.0

Since Mar 8Pushed 4y ago11 watchersCompare

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

READMEChangelog (9)DependenciesVersions (10)Used By (1)

[![face_post_tbc_payment](https://cloud.githubusercontent.com/assets/8479569/7435079/5aebe7cc-f051-11e4-8ee1-d85b0e36a8a9.jpg)](https://cloud.githubusercontent.com/assets/8479569/7435079/5aebe7cc-f051-11e4-8ee1-d85b0e36a8a9.jpg)

TBC Credit Card Payment Gateway (php-library)
=============================================

[](#tbc-credit-card-payment-gateway-php-library)

Making credit card payments work on your website (through a local bank) is pain! So to make everyone's life a bit easier we are sharing this php-library on GitHub.

### SMS / DMS

[](#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.

### Install

[](#install)

It is possible to simply include this library [see example](https://github.com/wearede/tbcpay-php/tree/master/example), but you should use composer instead.

run in terminal:

```
composer require wearede/tbcpay-php

```

### Creating object

[](#creating-object)

```
$Payment = new TbcPayProcessor('/cert/tbcpay.pem', '0DhJ4AdxVuPZmz3F4y', $_SERVER['REMOTE_ADDR']);
```

1. Certificate absolute path
2. Certificate passphrase
3. Client ip address

### Methods

[](#methods)

Method name**sms\_start\_transaction()****dms\_start\_authorization()****dms\_make\_transaction($trans\_id)****get\_transaction\_result($trans\_id)****reverse\_transaction($trans\_id, $amount = '', $suspected\_fraud = '')****refund\_transaction($trans\_id)****credit\_transaction($trans\_id, $amount = '')****close\_day()**### Example implementations

[](#example-implementations)

- To get started quickly have a look at the [fully functional working prototype](https://github.com/wearede/tbcpay-php-example).
- You can find a [simple example here](https://github.com/wearede/tbcpay-php/tree/master/example).

### Instructions

[](#instructions)

Relevant to a [simple example here](https://github.com/wearede/tbcpay-php/tree/master/example).

#### Chores

[](#chores)

1. Ask TBC to generate a certificate.
2. Tell TBC your server IP so they can whitelist it.
3. create `example.com/ok.php` and `example.com/fail.php` urls and communicate these to TBC.
    - ok url - is used for redirecting back user in almost all situations (even when card has insuficient funds and transaction fails!).
    - fail url - is used for redirecting back user when technical error occurs (very rare).

#### Flow

[](#flow)

1. `start.example` Here we start our process. We call TBC servers using `sms_start_transaction()` and get `$trans_id` in return.
    - We use returned $trans\_id to redirect user to a TBC page, where credit card info can be entered.
    - After user fills out card info he is thrown back to our `ok.example` url on our server.
2. Take a look at `ok.example` We get `$trans_id` back from TBC, and we plug that in `get_transaction_result($trans_id)`.
3. `get_transaction_result($trans_id)` tells us if transaction was success or not. `array('RESULT' => 'OK')` for example is success message, transaction went through.

### Common issues

[](#common-issues)

- TBC bank provides SSL certificate in **.p12** format, we need it in .pem format, to transform use command: `openssl pkcs12 -in *.p12 -out tbcpay.pem`.
- Move cert directory somewhere non public as a security meassure. Give it correct permissions so that php can read it.
- SDK needs outgoing port 18443 open to communicate with TBC. Some hosting services do not allow this.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.9% 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 ~230 days

Total

9

Last Release

1517d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49003d32229cd451675a8a645b658c5021649cb99f71ea1297e3ab69712e3f9d?d=identicon)[sandrodz](/maintainers/sandrodz)

---

Top Contributors

[![sandrodz](https://avatars.githubusercontent.com/u/8479569?v=4)](https://github.com/sandrodz "sandrodz (95 commits)")[![Lotuashvili](https://avatars.githubusercontent.com/u/6238393?v=4)](https://github.com/Lotuashvili "Lotuashvili (1 commits)")[![xxzefgh](https://avatars.githubusercontent.com/u/6980903?v=4)](https://github.com/xxzefgh "xxzefgh (1 commits)")

---

Tags

credit-cardpayment-gatewaytbc

### Embed Badge

![Health badge](/badges/wearede-tbcpay-php/health.svg)

```
[![Health](https://phpackages.com/badges/wearede-tbcpay-php/health.svg)](https://phpackages.com/packages/wearede-tbcpay-php)
```

PHPackages © 2026

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