PHPackages                             tendopay/tendopay-sdk-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. tendopay/tendopay-sdk-php

ActiveLibrary[API Development](/categories/api)

tendopay/tendopay-sdk-php
=========================

TendoPay API Integration

0.9.3(1y ago)148.3k↑208.3%2[1 PRs](https://github.com/TendoPayPlugins/tendopay-sdk-php/pulls)MITPHPPHP &gt;=7.2CI failing

Since Jun 6Pushed 5mo agoCompare

[ Source](https://github.com/TendoPayPlugins/tendopay-sdk-php)[ Packagist](https://packagist.org/packages/tendopay/tendopay-sdk-php)[ Docs](https://tendopay.ph/)[ RSS](/packages/tendopay-tendopay-sdk-php/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (4)Versions (10)Used By (0)

TendoPay SDK for PHP (v2)
=========================

[](#tendopay-sdk-for-php-v2)

If you find a document for v1, please go to [TendoPay SDK for PHP (v1)](./README_v1.md)

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

[](#requirements)

PHP 7.0 and later.

Upgrade
-------

[](#upgrade)

[UPGRADE from v1](./UPGRADE.md)

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

[](#installation)

### Using Composer

[](#using-composer)

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

```
composer require tendopay/tendopay-sdk-php
```

Run SDK Tester
--------------

[](#run-sdk-tester)

- Run a sample server

```
php -s localhost:8000 -t vendor/tendopay/tendopay-sdk-php/samples
```

- Open browser and goto

```
http://localhost:8000/
```

Code Examples
-------------

[](#code-examples)

### Create TendoPayClient

[](#create-tendopayclient)

- Using .env > MERCHANT\_ID,MERCHANT\_SECRET for test can get them at [TendoPay Sandbox](https://sandbox.tendopay.ph)

```
## Client Credentials
CLIENT_ID=
CLIENT_SECRET=

## Redirect URI when the transaction is processed
REDIRECT_URL=https://localhost:8000/purhase.php

## Enable Sandbox, it must be false in production
TENDOPAY_SANDBOX_ENABLED=false
```

```
use TendoPay\SDK\TendoPayClient;

$client = new TendoPayClient();
```

- Using $config variable

```
use TendoPay\SDK\TendoPayClient;

$config = [
    'CLIENT_ID' => '',
    'CLIENT_SECRET' => '',
    'REDIRECT_URL' => '',
    'TENDOPAY_SANDBOX_ENABLED' => false,
];
$client = new TendoPayClient($config);
```

### Make Payment

[](#make-payment)

```
use TendoPay\SDK\Exception\TendoPayConnectionException;
use TendoPay\SDK\Models\Payment;
use TendoPay\SDK\V2\TendoPayClient;

### S:Merchant set proper values
$merchant_order_id = $_POST['tp_merchant_order_id'];
$request_order_amount = $_POST['tp_amount'];
$request_order_title = $_POST['tp_description'];
$redirectUrl = $_POST['tp_redirect_url'] ?? '';
### E:Merchant set proper values

$client = new TendoPayClient();

try {
    $payment = new Payment();
    $payment->setMerchantOrderId($merchant_order_id)
        ->setDescription($request_order_title)
        ->setRequestAmount($request_order_amount)
        ->setCurrency('PHP')
        ->setRedirectUrl($redirectUrl);

    $client->setPayment($payment);

    $redirectURL = $client->getAuthorizeLink();
    header('Location: '.$redirectURL);
} catch (TendoPayConnectionException $e) {
    echo 'Connection Error:'.$e->getMessage();
} catch (Exception $e) {
    echo 'Runtime Error:'.$e->getMessage();
}
```

### Callback (redirected page)

[](#callback-redirected-page)

```
use TendoPay\SDK\Exception\TendoPayConnectionException;
use TendoPay\SDK\Models\VerifyTransactionRequest;
use TendoPay\SDK\V2\TendoPayClient;

$client = new TendoPayClient();

try {
    if (TendoPayClient::isCallBackRequest($_REQUEST)) {
        $transaction = $client->verifyTransaction(new VerifyTransactionRequest($_REQUEST));

        if (!$transaction->isVerified()) {
            throw new UnexpectedValueException('Invalid signature for the verification');
        }

        if ($transaction->getStatus() == \TendoPay\SDK\V2\ConstantsV2::STATUS_SUCCESS) {
            // PAID
            // Save $transactionNumber here
            // Proceed merchant post order process
        } else if ($transaction->getStatus() == \TendoPay\SDK\V2\ConstantsV2::STATUS_FAILURE) {
            // FAILED
            // do something in failure case
            // error message $transaction->getMessage()
        }
    }
} catch (TendoPayConnectionException $e) {
    echo 'Connection Error:'.$e->getMessage();
} catch (Exception $e) {
    echo 'Runtime Error:'.$e->getMessage();
}
```

### Cancel Payment

[](#cancel-payment)

```
use TendoPay\SDK\Exception\TendoPayConnectionException;
use TendoPay\SDK\V2\TendoPayClient;

$client = new TendoPayClient();

try {
    $client->cancelPayment($transactionNumber);
    // merchant process here

} catch (TendoPayConnectionException $e) {
    echo 'Connection Error:'.$e->getMessage();
} catch (Exception $e) {
    echo 'Runtime Error:'.$e->getMessage();
}
```

### Show Transaction Detail

[](#show-transaction-detail)

```
use TendoPay\SDK\Exception\TendoPayConnectionException;
use TendoPay\SDK\V2\TendoPayClient;

$client = new TendoPayClient();

try {

    $transaction = $client->getTransactionDetail($transactionNumber);

    // merchant process here
    // $transaction->getMerchantId();
    // $transaction->getMerchantOrderId();
    // $transaction->getAmount();
    // $transaction->getTransactionNumber();
    // $transaction->getCreatedAt();
    // $transaction->getStatus();

} catch (TendoPayConnectionException $e) {
    echo 'Connection Error:'.$e->getMessage();
} catch (Exception $e) {
    echo 'Runtime Error:'.$e->getMessage();
}
```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance55

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% 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 ~274 days

Recently: every ~460 days

Total

8

Last Release

661d ago

PHP version history (2 changes)0.8.0PHP &gt;=7.1

0.9.2PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5a1077e32acd0b2258cf5c5e28515f7d0c4914291a367953a576b3226c54dddf?d=identicon)[tendopay](/maintainers/tendopay)

---

Top Contributors

[![tangoslee](https://avatars.githubusercontent.com/u/42908571?v=4)](https://github.com/tangoslee "tangoslee (16 commits)")[![pmkay](https://avatars.githubusercontent.com/u/4557167?v=4)](https://github.com/pmkay "pmkay (10 commits)")

---

Tags

apie-commercetendopayinstallment payment

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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