PHPackages                             nvuln/tiktokshop-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. nvuln/tiktokshop-php

Abandoned → [ecomphp/tiktokshop-php](/?search=ecomphp%2Ftiktokshop-php)ArchivedLibrary[API Development](/categories/api)

nvuln/tiktokshop-php
====================

Unofficial Tiktok Shop API Client in PHP

v1.2.0(2y ago)04.8k—10%Apache-2.0PHPPHP ^7.2|^8.0

Since Sep 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/nVuln/tiktokshop-php)[ Packagist](https://packagist.org/packages/nvuln/tiktokshop-php)[ RSS](/packages/nvuln-tiktokshop-php/feed)WikiDiscussions master Synced 1mo ago

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

Unofficial Tiktok Shop API Client in PHP
========================================

[](#unofficial-tiktok-shop-api-client-in-php)

[![Total Downloads](https://camo.githubusercontent.com/ab964c1b6c5295952ff8bf0de96227cd77c58a59eb531c22a0c107d8100493ed/68747470733a2f2f706f7365722e707567782e6f72672f6e76756c6e2f74696b746f6b73686f702d7068702f646f776e6c6f616473)](https://packagist.org/packages/nvuln/tiktokshop-php)[![Latest Stable Version](https://camo.githubusercontent.com/84a21593dfb980fbdf72c79f9059941e4709908d0a21caba1234b34b98628cf8/68747470733a2f2f706f7365722e707567782e6f72672f6e76756c6e2f74696b746f6b73686f702d7068702f762f737461626c65)](https://packagist.org/packages/nvuln/tiktokshop-php)[![Latest Unstable Version](https://camo.githubusercontent.com/a7f83db2d3ad33c355f27f1b6abb736f3b376b4aa5360b57f59be1dedb622706/68747470733a2f2f706f7365722e707567782e6f72672f6e76756c6e2f74696b746f6b73686f702d7068702f762f756e737461626c65)](https://packagist.org/packages/nvuln/tiktokshop-php)[![Build Status](https://camo.githubusercontent.com/f643153af9be83f45922f2a3b5cd688ade678ab9a1e4790436da88ef0f2ce041/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e76756c6e2f74696b746f6b73686f702d7068702f63692e796d6c3f6272616e63683d6d6173746572266c6162656c3d63692532306275696c64267374796c653d666c61742d737175617265)](https://github.com/nvuln/tiktokshop-php/actions?query=workflow%3ATest)[![License](https://camo.githubusercontent.com/7279a4abd2f6aef863be1ef752e375c239542782bef634a3c39a3cdc3014d7d7/68747470733a2f2f706f7365722e707567782e6f72672f6e76756c6e2f74696b746f6b73686f702d7068702f6c6963656e7365)](https://packagist.org/packages/nvuln/tiktokshop-php)

Tiktok Shop API Client is a simple SDK implementation of Tiktok Shop API.

This package used Legacy API version (pre-Sept 2023). More detail here:

If you looking for API version 202309, please install package `ecomphp/tiktokshop-php`

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

[](#installation)

Install with Composer

```
composer require nvuln/tiktokshop-php
```

Configure TiktokShop PHP Client
-------------------------------

[](#configure-tiktokshop-php-client)

```
use NVuln\TiktokShop\Client;

$app_key = 'your app key';
$app_secret = 'your app secret';

$client = new Client($app_key, $app_secret);
```

### Enable sandbox mode if you want to test the client

[](#enable-sandbox-mode-if-you-want-to-test-the-client)

```
$client->useSandboxMode();
```

Grant token
-----------

[](#grant-token)

There is a Auth class to help you getting the token from the shop using oAuth.

```
$auth = $client->auth();
```

1. Create the authentication request

```
$_SESSION['state'] = $state = str_random(40); // random string
$auth->createAuthRequest($state);
```

> If you want the function to return the authentication url instead of auto-redirecting, you can set the argument $return (2nd argument) to true.

```
$authUrl = $auth->createAuthRequest($state, true);

// redirect user to auth url
header('Location: '.$authUrl);
```

2. Get authentication code when redirected back to `Redirect callback URL` after app authorization and exchange it for access token

```
$authorization_code = $_GET['code'];
$token = $auth->getToken($authorization_code);

$access_token = $token['access_token'];
$refresh_token = $token['refresh_token'];
```

3. Get authorized Shop ID

```
$access_token = $token['access_token'];
$client->setAccessToken($access_token);

$authorizedShopList = $client->Shop->getAuthorizedShop();

// extract shop_id from $authorizedShopList
```

Refresh your access token
-------------------------

[](#refresh-your-access-token)

> Access token will be expired soon, so you need refresh new token by using `refresh_token`

```
$new_token = $auth->refreshNewToken($refresh_token);

$new_access_token = $new_token['access_token'];
$new_refresh_token = $new_token['refresh_token'];
```

Usage API Example
-----------------

[](#usage-api-example)

> You need `access_token` and `shop_id` to start using TiktokShop API

```
$client = new Client($app_key, $app_secret);
$client->setAccessToken($access_token);
$client->setShopId($shop_id);
```

- Get product list: [api document](https://developers.tiktok-shops.com/documents/document/237487)

```
$products = $client->Product->getProductList([
    'page_size' => 50,
]);
```

- Get order list: [api document](https://developers.tiktok-shops.com/documents/document/237434)

```
$orders = $client->Order->getOrderList([
    'order_status' => 100, // Unpaid order
    'page_size' => 50,
]);
```

Webhook
-------

[](#webhook)

Use webhook to receive incoming notification from tiktok shop

```
$webhook = $client->webhook();
```

or manually configure the webhook receiver

```
use NVuln\TiktokShop\Webhook;
use NVuln\TiktokShop\Errors\TiktokShopException;

$webhook = new Webhook($client);
try {
    $webhook->verify();
    $webhook->capture($_POST);
} catch (TiktokShopException $e) {
    echo "webhook error: " . $e->getMessage() . "\n";
}
```

```
echo "Type: " . $webhook->getType() . "\n";
echo "Timestamp: " . $webhook->getTimestamp() . "\n";
echo "Shop ID: " . $webhook->getShopId() . "\n";
echo "Data: \n"; // data is array
print_r($webhook->getData());
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~19 days

Recently: every ~29 days

Total

17

Last Release

1019d ago

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

v1.1.4PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7086b3bf4e8970e697e84056b9eff99021a395697375cc1f03b3bafea63f3972?d=identicon)[nVuln](/maintainers/nVuln)

---

Top Contributors

[![nVuln](https://avatars.githubusercontent.com/u/54855446?v=4)](https://github.com/nVuln "nVuln (7 commits)")[![fgmpr](https://avatars.githubusercontent.com/u/90197805?v=4)](https://github.com/fgmpr "fgmpr (4 commits)")[![marcum8er](https://avatars.githubusercontent.com/u/119655028?v=4)](https://github.com/marcum8er "marcum8er (3 commits)")[![febrihidayan](https://avatars.githubusercontent.com/u/42211742?v=4)](https://github.com/febrihidayan "febrihidayan (1 commits)")[![kamil-fityka](https://avatars.githubusercontent.com/u/113036300?v=4)](https://github.com/kamil-fityka "kamil-fityka (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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