PHPackages                             telepaycash/sdk-telepay-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. [HTTP &amp; Networking](/categories/http)
4. /
5. telepaycash/sdk-telepay-php

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

telepaycash/sdk-telepay-php
===========================

Library to receive payments with TelePay

v1.2.0(3y ago)716MITPHPPHP &gt;=7.0

Since Apr 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/TelePay-cash/telepay-php)[ Packagist](https://packagist.org/packages/telepaycash/sdk-telepay-php)[ RSS](/packages/telepaycash-sdk-telepay-php/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (1)Versions (9)Used By (0)

PHP SDK for the TelePay API
===========================

[](#php-sdk-for-the-telepay-api)

[![TelePay PHP](https://github.com/TelePay-cash/telepay-php/raw/main/docs/cover.png?raw=true)](https://github.com/TelePay-cash/telepay-php/blob/main/docs/cover.png?raw=true)

TelePay client library for the PHP language, so you can easely process cryptocurrency payments using the REST API.

[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![CI](https://github.com/TelePay-cash/telepay-php/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/TelePay-cash/telepay-php/actions/workflows/ci.yml)[![Last commit](https://camo.githubusercontent.com/26e4d211813173b4af3f92528dc4d45b69e9c37ce0dca81937989db7f56bae8d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f74656c657061792d636173682f74656c657061792d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/telepay-cash/telepay-php/commits)[![GitHub commit activity](https://camo.githubusercontent.com/4d21e65437c5056778deb69b46df36551003e145bea51927e3359e51470d8f8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f74656c657061792d636173682f74656c657061792d7068703f7374796c653d666c61742d737175617265)](https://github.com/telepay-cash/telepay-php/commits)[![Github Stars](https://camo.githubusercontent.com/bc84f64a3512bfe399e4aa0749b8541857177653f52fc24874a56ad528a12f17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f74656c657061792d636173682f74656c657061792d7068703f7374796c653d666c61742d737175617265266c6f676f3d67697468756226)](https://github.com/telepay-cash/telepay-php/stargazers)[![Github Forks](https://camo.githubusercontent.com/3b0327d9bdcc0d1aa9f58c2c5d5d6e3b1c003aeca023199a7b18f21063d5d9bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f74656c657061792d636173682f74656c657061792d7068703f7374796c653d666c61742d737175617265266c6f676f3d676974687562)](https://github.com/telepay-cash/telepay-php/network/members)[![Github Watchers](https://camo.githubusercontent.com/a24ffcd0736944771e05ecbc871591b1d1a210b8eda8c06b7edb53388f868537/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f77617463686572732f74656c657061792d636173682f74656c657061792d7068703f7374796c653d666c61742d737175617265266c6f676f3d676974687562)](https://github.com/telepay-cash/telepay-php)[![GitHub contributors](https://camo.githubusercontent.com/d880c01c96a8241ccb853af28a64035363a2a0f3beab559dcf9aae2b943f6ca2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f74656c657061792d636173682f74656c657061792d7068703f6c6162656c3d636f6465253230636f6e7472696275746f7273267374796c653d666c61742d737175617265)](https://github.com/telepay-cash/telepay-php/graphs/contributors)[![Telegram](https://camo.githubusercontent.com/bc24be52d2968b194b4422089228ef490d690aeda573b28597b1ff7d1b28c260/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54656c656772616d2d3243413545303f7374796c653d666c61742d73717565617265266c6f676f3d74656c656772616d266c6f676f436f6c6f723d7768697465)](https://t.me/TelePayCash)[![Blog](https://camo.githubusercontent.com/f9018a0f8c8848e625179cefcdf0c617ed38310ca3f938735ad1784cb89b4fde/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5253532d4646413530303f7374796c653d666c61742d737175617265266c6f676f3d727373266c6f676f436f6c6f723d7768697465)](https://blog.telepay.cash)

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

[](#installation)

Install the package with composer:

```
composer require telepaycash/sdk-telepay-php
```

Using the library
-----------------

[](#using-the-library)

Import the library classes using the Composer autoload:

```
require 'vendor/autoload.php';

use TelePay\TelePayClient;
use TelePay\TelePayEnvironment;
```

Configure the TelePay client using the secret of your merchant

```
$clientSecret = "YOUR API SECRET KEY";

$environment = new TelePayEnvironment($clientSecret);

$telepay = new TelePayClient($environment);
```

**Get your current merchant**

```
$me = $telepay->getMe();
print_r($me);
```

Response

```
Array
(
    [version] => 1.0
    [merchant] => Array
        (
            [name] => MyMerchant
            [url] => https://mymerchant.com/
            [logo_url] => https://ik.imagekit.io/telepay/merchants/descarga_-k4ehiTd5.jpeg
            [logo_thumbnail_url] => https://ik.imagekit.io/telepay/tr:n-media_library_thumbnail/merchants/descarga_-k4ehiTd5.jpeg
            [verified] =>
            [username] => merchant_username
            [public_profile] => https://telepay.cash/to/merchant_username
            [owner] => Array
                (
                    [first_name] => Raubel
                    [last_name] => Guerra
                    [username] => raubel1993
                )

            [created_at] => 2022-04-13T00:51:37.802614Z
            [updated_at] =>
        )
)
```

[Read docs](https://telepay.readme.io/reference/getme)

**Get the balance of all merchant wallets**

```
$balances = $telepay->getAllBalances();
print_r($balances);
```

Response

```
Array
(
    [wallets] => Array
        (
            [0] => Array
                (
                    [asset] => TON
                    [blockchain] => TON
                    [balance] => 10.005
                    [network] => mainnet
                )

            [1] => Array
                (
                    [asset] => TON
                    [blockchain] => TON
                    [balance] => 0
                    [network] => testnet
                )

        )

)
```

[Read docs](https://telepay.readme.io/reference/getbalance)

**Get the balance of one of the merchant wallets**

```
$asset = new TelePayAssetInput("TON", "TON", "mainnet");
$balance = $telepay->getBalance($asset);
print_r($balance);
```

Response

```
Array
(
    [wallets] => Array
        (
            [0] => Array
                (
                    [asset] => TON
                    [blockchain] => TON
                    [balance] => 0
                    [network] => mainnet
                )

        )

)
```

[Read docs](https://telepay.readme.io/reference/getbalance-1)

**Get the assets**

Get assets suported by TelePay. [Read docs](https://telepay.readme.io/reference/getassets)

```
$assets = $telepay->getAssets();
print_r($assers);
```

Response

```
Array
(
    [assets] => Array
        (
            [0] => Array
                (
                    [asset] => TON
                    [blockchain] => TON
                    [usd_price] => 1.050999999999999934
                    [url] => https://ton.org
                    [networks] => Array
                        (
                            [0] => mainnet
                            [1] => testnet
                        )

                    [coingecko_id] => the-open-network
                )

        )

)
```

You can get the detail of a single asset. [Read docs](https://telepay.readme.io/reference/getasset)

```
$asset = new TelePayAssetInput("TON", "TON", "mainnet");
$assetDetail = $telepay->getAsset($asset);
```

**Create one invoice**

```
$orderId = 56;
$invoice = new TelePayInvoiceInput("TON", "TON", "testnet", "0.2");
$invoice->setDescription("Test using SDK TelePay PHP");
$invoice->setMetadata([
    "my_reference_id" => $orderId,
    "other_metadata" => "any value"
]);
$invoice->setSuccessUrl("https://www.example.com/payment_success?order_id=$orderId");
$invoice->setCancelUrl("https://www.example.com/payment_cancelled?order_id=$orderId");

$respCreateInvoice = $telepay->createInvoice($invoice);
print_r($respCreateInvoice);
```

Response

```
Array
(
    [number] => YJ1EJO9PLA
    [asset] => TON
    [blockchain] => TON
    [network] => mainnet
    [status] => pending
    [amount] => 2.000000000000000000
    [amount_remaining] => 0.000000000000000000
    [amount_real] => 0.000000000000000000
    [description] => Test using SDK TelePay PHP
    [metadata] => Array
        (
            [my_reference_id] => 56
            [other_metadata] => any value
        )

    [checkout_url] => https://telepay.cash/checkout/YJ1EJO9PLA
    [onchain_url] => ton://transfer/UQDoFjaqMtuxkJV-caGiEdxMxjkTAWU9oskjpfAA1uwHbe4u?amount=2000000000
    [success_url] => https://www.example.com/payment_success?order_id=56
    [cancel_url] => https://www.example.com/payment_cancelled?order_id=56
    [explorer_url] =>
    [expires_at] => 2022-06-28T00:09:52.038782Z
    [created_at] => 2022-06-27T14:09:52.038908Z
    [updated_at] =>
)
```

[Read docs](https://telepay.readme.io/reference/createinvoice)

**View invoices**

Find many invoices. [Read docs](https://telepay.readme.io/reference/getinvoices)

```
$invoicesResponse = $telepay->getInvoices();
```

Find one invoice by number. [Read docs](https://telepay.readme.io/reference/getinvoice)

```
$invoiceNumber = "UIOAXSSFNB";
$respGetInvoice = $telepay->getInvoice($invoiceNumber);
```

**Cancel invoice**

```
$invoiceNumber = "8N1DLRKV5S";
$respCancelInvoice = $telepay->cancelInvoice($invoiceNumber);
print_r($respCancelInvoice);
```

Response

```
Array
(
    [number] => YJ1EJO9PLA
    [asset] => TON
    [blockchain] => TON
    [network] => mainnet
    [status] => cancelled
    [amount] => 2.000000000000000000
    [amount_remaining] => 0.000000000000000000
    [amount_real] => 0.000000000000000000
    [description] => Test using SDK TelePay PHP
    [metadata] => Array
        (
            [other_metadata] => any value
            [my_reference_id] => 56
        )
    [checkout_url] => https://telepay.cash/checkout/YJ1EJO9PLA
    [onchain_url] =>
    [success_url] => https://www.example.com/payment_success?order_id=56
    [cancel_url] => https://www.example.com/payment_cancelled?order_id=56
    [explorer_url] =>
    [expires_at] => 2022-06-28T00:09:52.038782Z
    [created_at] => 2022-06-27T14:09:52.038908Z
    [updated_at] => 2022-06-27T14:09:53.205920Z
)
```

**Delete invoice**

```
$invoiceNumber = "8N1DLRKV5S";
$respDeleteInvoice = $telepay->deleteInvoice($invoiceNumber);
print_r($respDeleteInvoice);
```

Response

```
Array
(
    [success] => invoice.deleted
    [message] => Invoice deleted.
)
```

**Transfer**

```
$transfer = new TelePayTransferInput("TON", "TON", "mainnet", "0.00005", "raubel1993");
$transfer->setMessage("Debt settled");

$respTransfer= $telepay->transfer($transfer);
print_r($respTransfer);
```

Response

```
Array
(
    [success] => transfer.ok
    [message] => Transfer performed.
)
```

[Read docs](https://telepay.readme.io/reference/transfer)

**Withdraw Fee**

```
$withdraw = new TelePayWithdrawInput("TON", "TON", "mainnet", "0.2", "EQCwLtwjII1yBfO3m6T9I7__6CUXj60ZFmN3Ww2aiLQLicsO");
$withdraw->setMessage("for my savings account");

$respWithdrawFee = $telepay->getWithdrawFee($withdraw);
print_r($respWithdrawFee);
```

Response

```
Array
(
    [blockchain_fee] => 0.001824
    [processing_fee] => 0.01
    [total] => 0.011824
)
```

**Withdraw**

```
$withdraw = new TelePayWithdrawInput("TON", "TON", "mainnet", "0.2", "EQCwLtwjII1yBfO3m6T9I7__6CUXj60ZFmN3Ww2aiLQLicsO");
$withdraw->setMessage("for my savings account");

$respWithdraw = $telepay->withdraw($withdraw);
print_r($respWithdraw);
```

Response

```
Array
(
    [success] => 1
)
```

**View webhooks**

Find many webhooks. [Read docs](https://telepay.readme.io/reference/getwebhooks)

```
$webhooksResponse = $telepay->getWebhooks();
```

Find one webhook by Id. [Read docs](https://telepay.readme.io/reference/getwebhook)

```
$webhookId = 325;
$webhookResponse = $telepay->getWebhook($webhookId);
print_r($webhookResponse);
```

Response

```
Array
(
    [id] => 325
    [url] => https://www.example.com/webhook
    [secret] => secret
    [events] => Array
        (
            [0] => invoice.completed
        )

    [active] => 1
)
```

**Create or update a webhook**

For create a webhook is required the url, a secret and the events associated. [Read docs](https://telepay.readme.io/reference/createwebhook)

```
$urlWebhook = "https://www.example.com/webhook";
$secretWebhook = "secret";
$eventsWebhook = [
    TelePayEvents::INVOICE_COMPLETED
];
$webhookInput = new TelePayWebhookInput($urlWebhook, $secretWebhook, $eventsWebhook);

$responseCreateWebhook = $telepay->createWebhook($webhookInput);
```

For update a webhook is required a webhookId and the new params. [Read docs](https://telepay.readme.io/reference/updatewebhook)

```
$webhookId = 325;
$responseUpdateWebhook = $telepay->updateWebhook($webhookId, $webhookInput);
```

**Activate or deativate a webhook**

```
$webhookId = 325;

$telepay->activateWebhook($webhookId);

$telepay->deactivateWebhook($webhookId);
```

**Delete a webhook**

```
$webhookId = 325;

$telepay->deleteWebhook($webhookId);
```

Tests
-----

[](#tests)

All endpoint responses were tested. To run the tests yourself, you need your TelePay merchant secret with at least 3 testnet toncoins, a Telepay user who will receive the test transfer, and a testnet wallet which will receive the test withdraw.

```
TELEPAY_SECRET_API_KEY= USERNAME_TELEPAY_TRANSFER= WHITDRAW_TO_WALLET= composer tests
```

Contributors ✨
--------------

[](#contributors-)

The library is made by ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

  [![](https://avatars.githubusercontent.com/u/49169590?v=4)
**Raubel Guerra**](https://www.linkedin.com/in/raubel-guerra-l%C3%B3pez-a8024a1b0/)
[💻](https://github.com/TelePay-cash/telepay-php/commits?author=raubel1993 "Code") [![](https://avatars.githubusercontent.com/u/18733370?v=4?s=100)
**Carlos Lugones**](https://carloslugones.com)
[🧑‍🏫](https://github.com/telepay-cash/telepay-node/commits?author=CarlosLugones "Mentoring") This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.4% 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 ~42 days

Recently: every ~70 days

Total

8

Last Release

1243d ago

Major Versions

v0.0.2 → v1.0.02022-04-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49169590?v=4)[Raubel](/maintainers/raubel1993)[@raubel1993](https://github.com/raubel1993)

![](https://avatars.githubusercontent.com/u/18733370?v=4)[Carlos Lugones](/maintainers/CarlosLugones)[@CarlosLugones](https://github.com/CarlosLugones)

---

Top Contributors

[![raubel1993](https://avatars.githubusercontent.com/u/49169590?v=4)](https://github.com/raubel1993 "raubel1993 (18 commits)")[![CarlosLugones](https://avatars.githubusercontent.com/u/18733370?v=4)](https://github.com/CarlosLugones "CarlosLugones (17 commits)")

---

Tags

apiclient-librarycryptocurrenciespaymentstonsdkrestpaymentstelepaytoncoin

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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