PHPackages                             pavolbiely/tatrabanka-api - 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. [API Development](/categories/api)
4. /
5. pavolbiely/tatrabanka-api

ActiveLibrary[API Development](/categories/api)

pavolbiely/tatrabanka-api
=========================

Tatra Banka - Open banking TB - REST API Client

8922[1 issues](https://github.com/pavolbiely/tatrabanka-api/issues)PHP

Since Jan 27Pushed 8y ago2 watchersCompare

[ Source](https://github.com/pavolbiely/tatrabanka-api)[ Packagist](https://packagist.org/packages/pavolbiely/tatrabanka-api)[ RSS](/packages/pavolbiely-tatrabanka-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Tatra Banka - Open banking TB
=============================

[](#tatra-banka---open-banking-tb)

[![Build Status](https://camo.githubusercontent.com/f33659af3a1ff53d856f91cfd61bdca694e19832c7f5a63e1c9e950e9e2efc1f/68747470733a2f2f7472617669732d63692e6f72672f7061766f6c6269656c792f746174726162616e6b612d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pavolbiely/tatrabanka-api)[![Coverage Status](https://camo.githubusercontent.com/ff84a94282d9510f27038b891080d6f9cbbbc64dafc684fc116eb23f1184ae15/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7061766f6c6269656c792f746174726162616e6b612d6170692f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pavolbiely/tatrabanka-api?branch=master)[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BHZKXCWAK2NNS)

PHP REST API Client for [Tatra Banka](https://www.tatrabanka.sk/)'s [Open Banking TB](https://www.tatrabanka.sk/sk/personal/ucet-platby/elektronicke-bankovnictvo/openbankingtb.html).

Sign up at [developer.tatrabanka.sk](https://developer.tatrabanka.sk) to get access to the API.

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

[](#installation)

Use composer to install this package.

Example of usage
----------------

[](#example-of-usage)

### Accounts API

[](#accounts-api)

Ask for the OAuth2 authorization

```
use TatraBankaApi\Accounts;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

$tb = new Accounts($clientId, $clientSecret, $redirectUri);
$tb->useSandbox(true);
header('Location: ' . $tb->getAuthorizationUrl());
```

Exchange the OAuth2 authorization code for an access token

```
use TatraBankaApi\Accounts;
use TatraBankaApi\TatraBankaApiException;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

try {
    $tb = new Accounts($clientId, $clientSecret, $redirectUri);
    $tb->useSandbox(true);
    $tb->requestAccessToken($_GET['code']); // using authorization_code grand type
} catch (TatraBankaApiException $e) {
    // ...
}
```

General usage

```
use TatraBankaApi\Accounts;
use TatraBankaApi\TatraBankaApiException;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

try {
    $tb = new Accounts($clientId, $clientSecret, $redirectUri);
    $tb->useSandbox(true);

    if ($tb->isAuthorized()) {
        // The operation provides the relevant data about bank customer's accounts in form of a list.
        print_r($tb->getAccounts());

        // The operation provides the relevant data from a bank customer's account identified by IBAN.
        print_r($tb->postAccountInfo('SK0511000000002600000054'));

        // The list of financial transactions perfomed on a customer's bank account withing a date period.
        print_r($tb->postTransactions('SK0511000000002600000054', Accounts::STATUS_ALL, new \DateTime('-1 month'),  new \DateTime('now'), 1, 10));
    }
} catch (TatraBankaApiException $e) {
    // ...
}
```

Payments API
------------

[](#payments-api)

Get the OAuth2 access token and prepare the payment instructions

```
use TatraBankaApi\Payments;
use TatraBankaApi\PaymentAmount;
use TatraBankaApi\PaymentParticipant;
use TatraBankaApi\TatraBankaApiException;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

try {
    $tb = new Payments($clientId, $clientSecret, $redirectUri);
    $tb->useSandbox(true);
    $tb->requestAccessToken(); // using client_credentials grand type
    $debtor = new PaymentParticipant('John Doe', 'SK0511000000002600000054');
    $creditor = new PaymentParticipant('John Doe', 'DE89370400440532013000');
    $amount = new PaymentAmount(100.15);
    $response = $tb->postPaymentSba(md5(uniqid('', true)), $debtor, $creditor, $amount, new \DateTime('tomorrow'), new \DateTime('now'), '/VS123/SS456/KS0308', 'Test');
    $authUrl = $tb->getAuthorizationUrl(['orderId' => $response->orderId]);
    header('Location: ' . $authUrl);
    exit;
} catch (TatraBankaApiException $e) {
    // ...
}
```

Exchange the OAuth2 authorization code for an access token and submit the payment

```
use TatraBankaApi\Payments;
use TatraBankaApi\TatraBankaApiException;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

try {
    $tb = new Payments($clientId, $clientSecret, $redirectUri);
    $tb->useSandbox(true);
    $tb->requestAccessToken($_GET['code']); // using authorization_code grand type
    print_r($tb->postPaymentSubmission());

} catch (TatraBankaApiException $e) {
    // ...
}
```

Get payment status

```
use TatraBankaApi\Payments;
use TatraBankaApi\TatraBankaApiException;

$clientId = '';
$clientSecret = '';
$redirectUri = '';
$orderId = ''; // order ID is generated by the postPaymentSba method

try {
    $tb = new Payments($clientId, $clientSecret, $redirectUri);
    $tb->useSandbox(true);
    $tb->requestAccessToken(); // using client_credentials grand type
    print_r($tb->getPaymentStatus(['orderId' => $orderId]));

} catch (TatraBankaApiException $e) {
    // ...
}
```

How to run tests?
-----------------

[](#how-to-run-tests)

Tests are build with [Nette Tester](https://tester.nette.org/). You can run it like this:

```
php -f tester ./ -c php.ini-mac --coverage coverage.html --coverage-src ../src
```

Minimum requirements
--------------------

[](#minimum-requirements)

- PHP 7.1+
- php-curl

License
-------

[](#license)

MIT License (c) Pavol Biely

Read the provided LICENSE file for details.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/253db396889b232a20df30f31398208f9abcf2ea8db0d9b3e086a76af8830895?d=identicon)[pavolbiely](/maintainers/pavolbiely)

---

Top Contributors

[![pavolbiely](https://avatars.githubusercontent.com/u/115791?v=4)](https://github.com/pavolbiely "pavolbiely (9 commits)")

---

Tags

api-clientoauth2openbankingrest-apirest-clienttatrabanka

### Embed Badge

![Health badge](/badges/pavolbiely-tatrabanka-api/health.svg)

```
[![Health](https://phpackages.com/badges/pavolbiely-tatrabanka-api/health.svg)](https://phpackages.com/packages/pavolbiely-tatrabanka-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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