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

ActiveLibrary[API Development](/categories/api)

tpaga/tpaga-php
===============

0.4.4(10y ago)31.0kApache v2PHPPHP &gt;=5.3.3

Since Dec 15Pushed 8y ago6 watchersCompare

[ Source](https://github.com/Tpaga/tpaga-php)[ Packagist](https://packagist.org/packages/tpaga/tpaga-php)[ Docs](http://tpaga.co)[ RSS](/packages/tpaga-tpaga-php/feed)WikiDiscussions master Synced today

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

DEPRECATED
==========

[](#deprecated)

DO NOT USE THIS PROJECT.

tpaga-php
=========

[](#tpaga-php)

TPAGA PHP Package

You can sign up for a Tpaga account at

Requirements
------------

[](#requirements)

PHP 5.3.3 and later.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require tpaga/tpaga-php
```

To use the bindings, use Composer's autoload:

```
require_once('vendor/autoload.php');
```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, include the init.php file.

```
require_once('/path/to/tpaga-php/init.php');
```

Getting Started
---------------

[](#getting-started)

Simple usage looks like:

```
require_once('./tpaga-php/init.php');

$config = new Tpaga\Configuration();

$private_token = 'd13fr8n7vhvkuch3lq2ds5qhjnd2pdd2';
$public_token = 'pk_test_qvbvuthlvqpijnr0elmtg5jh';

$apiClient = new Tpaga\ApiClient($config);

function create_customer() {

    $GLOBALS["config"]->setUsername($GLOBALS["private_token"]);

    $customer = new Tpaga\Model\Customer();
    $customer->setFirstName("Numa");
    $customer->setLastName("Nigerio");
    $customer->setGender("M");
    $customer->setEmail("pericodelospalotes@nowhere.org");
    $customer->setPhone("6326800514");

    $customer_api = new Tpaga\Api\CustomerAPI($GLOBALS["apiClient"]);

    try {
        $persisted_customer = $customer_api->createCustomer($customer);
        var_dump($persisted_customer);
        return $persisted_customer;
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }

}

function tokenize_credit_card() {

    $GLOBALS["config"]->setUsername($GLOBALS["public_token"]);

    $cctoken = new Tpaga\Model\CreditCardToken();
    $cctoken->setPrimaryAccountNumber("4111111111111111");
    $cctoken->setExpirationMonth("08");
    $cctoken->setExpirationYear("2020");
    $cctoken->setCardHolderName("John Smith");

    $cctoken_api = new Tpaga\Api\tokenizeAPI($GLOBALS["apiClient"]);

    try {
        $persisted_cctoken = $cctoken_api->tokenizeCreditCard($cctoken);
        var_dump($persisted_cctoken);
        return $persisted_cctoken;
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }

}

function associate_token_to_customer($customer_id, $token) {
    $GLOBALS["config"]->setUsername($GLOBALS["private_token"]);

    $assoc_api = new Tpaga\Api\TokenApi($GLOBALS["apiClient"]);

    try {
        $persisted_cc = $assoc_api->addCreditCardToken($customer_id, $token);
        var_dump($persisted_cc);
        return $persisted_cc;
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }
}

function charge($cc_token) {

    $GLOBALS["config"]->setUsername($GLOBALS["private_token"]);

    $charge = new Tpaga\Model\CreditCardCharge();
    $charge->setCreditCard($cc_token);
    $charge->setAmount(20000);
    $charge->setTaxAmount(200);
    $charge->setCurrency("COP");
    $charge->setDescription("Sample description");
    $charge->setOrderId("Sample order Id");
    $charge->setInstallments(1);
    $charge->setThirdPartyId("Sample TPId" );
    $charge_api = new Tpaga\Api\ChargeAPI($GLOBALS["apiClient"]);

    try {
        $response = $charge_api->addCreditCardCharge($charge);
        var_dump($response);
        return $response;
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }

}

function refund($charge_id) {

    $GLOBALS["config"]->setUsername($GLOBALS["private_token"]);

    $refund_request = new Tpaga\Model\CreditCardRefund();
    $refund_request->setId($charge_id);
    $refund_api = new Tpaga\Api\RefundApi($GLOBALS["apiClient"]);

    try {
        $response = $refund_api->refundCreditCardCharge($refund_request);
        var_dump($response);
        return $response;
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }

}

$customer = create_customer();
$cctoken = tokenize_credit_card();
$credit_card = associate_token_to_customer($customer->getId(), $cctoken);
$charge = charge($credit_card->getId());
refund($charge->getId());
```

Documentation
-------------

[](#documentation)

Please see  for extra documentation.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

3850d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16062878?v=4)[Soleyda Manrique Naranjo](/maintainers/smanriquen)[@smanriquen](https://github.com/smanriquen)

---

Top Contributors

[![neoecos](https://avatars.githubusercontent.com/u/1490677?v=4)](https://github.com/neoecos "neoecos (4 commits)")[![smanriquen](https://avatars.githubusercontent.com/u/16062878?v=4)](https://github.com/smanriquen "smanriquen (4 commits)")

---

Tags

phpapisdkswagger

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[dwolla/dwollaswagger

15455.0k](/packages/dwolla-dwollaswagger)[clever/clever-php

231.6k](/packages/clever-clever-php)

PHPackages © 2026

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