PHPackages                             darkghosthunter/transbank - 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. darkghosthunter/transbank

ActiveLibrary[API Development](/categories/api)

darkghosthunter/transbank
=========================

Easy-to-use Transbank SDK for PHP.

v2.1.3(4y ago)041411MITPHPPHP ^8.0

Since Apr 4Pushed 4y agoCompare

[ Source](https://github.com/DarkGhostHunter/Transbank)[ Packagist](https://packagist.org/packages/darkghosthunter/transbank)[ Fund](https://paypal.me/darkghosthunter)[ Fund](https://ko-fi.com/DarkGhostHunter)[ RSS](/packages/darkghosthunter-transbank/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (8)Dependencies (8)Versions (10)Used By (1)

[![rawpixel - Unsplash (UL) #SEDqvdbkDQw](https://camo.githubusercontent.com/b7056f32f6018d017df012c9dcda194d3cec36c4db72ff39ef94edf7ecf5762d/68747470733a2f2f696d616765732e756e73706c6173682e636f6d2f70686f746f2d313631343236373131393037372d3531626463626639663737613f69786c69623d72622d312e322e3126697869643d65794a6863484266615751694f6a45794d446439266175746f3d666f726d6174266669743d63726f7026773d3132383026683d34303026713d3830)](https://camo.githubusercontent.com/b7056f32f6018d017df012c9dcda194d3cec36c4db72ff39ef94edf7ecf5762d/68747470733a2f2f696d616765732e756e73706c6173682e636f6d2f70686f746f2d313631343236373131393037372d3531626463626639663737613f69786c69623d72622d312e322e3126697869643d65794a6863484266615751694f6a45794d446439266175746f3d666f726d6174266669743d63726f7026773d3132383026683d34303026713d3830)

[![Latest Stable Version](https://camo.githubusercontent.com/a6c9c8ff6d01227465b4b70dc03d5685d28824c4d80bab878ea5ff0d9dc68ac0/68747470733a2f2f706f7365722e707567782e6f72672f6461726b67686f737468756e7465722f7472616e7362616e6b2f762f737461626c65)](https://packagist.org/packages/darkghosthunter/transbank) [![License](https://camo.githubusercontent.com/27efe80b0f6bd50aa7ee4328e772bba890829fda1ede455123c8b2b3381c1dc7/68747470733a2f2f706f7365722e707567782e6f72672f6461726b67686f737468756e7465722f7472616e7362616e6b2f6c6963656e7365)](https://packagist.org/packages/darkghosthunter/transbank) [![](https://camo.githubusercontent.com/f65d679647b8da24634fba6101f1e1ce90002439deba18bd3a782b331ae9758d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6461726b67686f737468756e7465722f7472616e7362616e6b2e737667)](https://camo.githubusercontent.com/f65d679647b8da24634fba6101f1e1ce90002439deba18bd3a782b331ae9758d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6461726b67686f737468756e7465722f7472616e7362616e6b2e737667) [![PHP Composer](https://github.com/DarkGhostHunter/TransbankApi/workflows/PHP%20Composer/badge.svg)](https://github.com/DarkGhostHunter/transbank/actions) [![Coverage Status](https://camo.githubusercontent.com/2d8fd2ff801ec6977a6694dbff48fc506deef1c07fca583d9855b08dafb3ff73/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4461726b47686f737448756e7465722f5472616e7362616e6b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/DarkGhostHunter/Transbank?branch=master)

Transbank
=========

[](#transbank)

Easy-to-use Transbank SDK for PHP.

Supports Webpay, Webpay Mall and Webpay Oneclick Mall.

Requisites:
-----------

[](#requisites)

- PHP 8.0 or later.
- `ext-json`
- [HTTP Client](#http-client)
- [Logger](#logger-optional) (optional)
- [Event dispatcher](#event-dispatcher-optional) (optional)

Installation
============

[](#installation)

Require it with [Composer](https://getcomposer.org/):

```
composer require darkghosthunter/webpay

```

Usage
-----

[](#usage)

This SDK mimics all the Webpay, Webpay Mall and Oneclick Mall methods from the official Transbank SDK for PHP.

You can check the documentation of these services in Transbank Developer's site.

- [Webpay](https://www.transbankdevelopers.cl/documentacion/webpay-plus#webpay-plus)
- [Webpay Mall](https://www.transbankdevelopers.cl/documentacion/webpay-plus#webpay-plus-mall)
- [Oneclick Mall](https://www.transbankdevelopers.cl/documentacion/oneclick)

Quickstart
----------

[](#quickstart)

Instance the `Transbank` object. You can do it manually, or with `make()` which will use Guzzle o Symfony HTTP Clients if any of these is already installed.

```
use DarkGhostHunter\Transbank\Transbank;

$transbank = Transbank::make();
```

If your project doesn't manage single instances, you can use `getInstance()` to receive a static Transbank instance.

```
use DarkGhostHunter\Transbank\Transbank;

$transbank = Transbank::getInstance();
```

### Environments and credentials

[](#environments-and-credentials)

By default, this SDK starts up in **integration** environment, where all transactions made are fake by using Transbank's own *integration* server.

To operate in production mode, where all transaction will be real, you will need to use `toProduction()` along an `array` with the name of the service and their production credentials issued by Transbank to you: `webpay`, `webpayMall` or `oneclickMall`.

```
$transbank->toProduction([
    'patpass' => ['555876543210','7a7b7d6cce5e...']
]);
```

> For Mall operations, the "child" commerce code is only needed when doing the transactions.

### Using a Service

[](#using-a-service)

To use a Transbank service, just call the method on the `Transbank` instance: `webpay`, `webpayMall` and `oneclickMall`.

```
use DarkGhostHunter\Transbank\Transbank;

$transaction = Transbank::singleton()
        ->webpay()
        ->create('order#123', 9990, 'https://app.com/compra');
```

### HTTP Client

[](#http-client)

This package is compatible with any PSR-18 compliant HTTP Client. IF you don't have one, you can install [Guzzle](https://docs.guzzlephp.org/) or [Symfony](https://symfony.com/doc/current/http_client.html)

```
composer require guzzlehttp/guzzle:>=7.0

```

or

```
composer require symfony/http-client:>=5.2

```

Some PHP platforms already ship with their own HTTP Client, like [Amp](https://amphp.org/http-client/), [ReactPHP](https://reactphp.org/http/), or [Swoole](https://www.swoole.co.uk/docs/modules/swoole-coroutine-http-client).

### Logger (optional)

[](#logger-optional)

You can use this package with any PSR-3 compliant Log system, allowing to debug transactions. You can use [Monolog](https://github.com/Seldaek/monolog) if you don't have one.

```
composer require monolog/monolog

```

All operations are sent to the logger using `debug`.

### Event dispatcher (optional)

[](#event-dispatcher-optional)

You can use this package with any PSR-14 compliant Event Dispatcher, so you will be able to hear transactions started and completed. You can use [Symfony](https://github.com/symfony/event-dispatcher) or [League](https://event.thephpleague.com/) if you don't have one.

```
composer require symfony/event-dispatcher

```

or

```
composer require league/event

```

This package sends the following events:

- `TransactionCreating` before a transaction is created in Transbank.
- `TransactionCreated` after a transaction is created in Transbank, but pending payment.
- `TransactionCompleted` after a transaction or refund is completed in Transbank, regardless of the success.

### Excepciones

[](#excepciones)

All exceptions implement `TransbankException`, so you can easily catch and check what happened.

> Transactions properly rejected by banks or credit card issuers do not throw exceptions.

There are 4 types of exceptions:

- `ClientException`: Any error byproduct of bad transactions, bad configuration, abort, abandonment, timeout or invalid values.
- `NetworkException`: Any communication error from Transbank Server, like network timeouts or wrong endpoints.
- `ServerException`: Any internal Transbank error.
- `UnknownException`: Any other error.

> Exceptions are **not** logged.

[Run examples locally](examples/README.md)
------------------------------------------

[](#run-examples-locally)

Licence
=======

[](#licence)

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

`Redcompra`, `Webpay`, `Oneclick`, `Onepay`, `Patpass` and `Transbank` are trademarks of [Transbank S.A.](https://www.transbank.cl/). This package and its author are not associated with Transbank S.A.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~0 days

Total

8

Last Release

1601d ago

Major Versions

v1.0.2 → v2.0.02021-12-22

PHP version history (2 changes)v1.0.0PHP &gt;=7.3

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5141911?v=4)[Italo](/maintainers/DarkGhostHunter)[@DarkGhostHunter](https://github.com/DarkGhostHunter)

---

Top Contributors

[![DarkGhostHunter](https://avatars.githubusercontent.com/u/5141911?v=4)](https://github.com/DarkGhostHunter "DarkGhostHunter (38 commits)")

---

Tags

paymentsphptransbankwebpayapisdkpaymentswebpaytransbank

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/darkghosthunter-transbank/health.svg)

```
[![Health](https://phpackages.com/badges/darkghosthunter-transbank/health.svg)](https://phpackages.com/packages/darkghosthunter-transbank)
```

###  Alternatives

[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[webit/w-firma-api

wFirma.pl API

1820.2k](/packages/webit-w-firma-api)

PHPackages © 2026

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