Download the PHP package laraditz/tiktok without Composer

On this page you can find all versions of the php package laraditz/tiktok. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tiktok

Laravel TikTok

Latest Version on Packagist Total Downloads GitHub Actions

A comprehensive Laravel package for seamless integration with the TikTok Shop API. This package provides a clean, intuitive interface for managing TikTok shops, handling authentication, processing orders, managing products, and receiving webhooks.

Buy Me A Coffee

Features

Requirements

Installation

You can install the package via composer:

Quick Start

1. TikTok Shop App Setup

Before using this package, you need to create a TikTok Shop app:

  1. Visit TikTok Shop Partner Center
  2. Create a new app or use an existing one
  3. Note your App Key and App Secret
  4. Configure the redirect URL: https://your-app-url.com/tiktok/seller/authorized

2. Environment Configuration

Add your TikTok Shop credentials to your .env file:

3. Publish Migration

You can publish the migration file via this command:

4. Run Migration

Run the migration command to create the necessary database tables:

This creates tables for shops, access tokens, requests, webhooks, orders, and returns.

5. Configuration (Optional)

Publish the configuration file if you need to customize settings:

6. Authorization Flow

To authorize a TikTok shop with your app:

  1. In Partner Center, go to App & Service and select your app. On the right side, you can find Authorization section with Copy authorization link button. Copy the URL and paste it into your browser address. The URL look like this:

  2. Login using the seller account that you want to authorized to be use for the app.

  3. TikTok redirects back to https://your-app-url.com/tiktok/seller/authorized
  4. Package automatically handles the authorization code exchange and token storage
  5. Shop is now ready for API calls

Available Methods

Here’s the full list of methods available in this package. Each method uses the same parameters defined in the TikTok Shop API Documentation. You don’t need to worry about adding common parameters like app_key, sign, timestamp, or shop_cipher because they’ll be automatically included whenever required.

Authentication Service auth()

Method Description Parameters
accessToken() Generate access token from authorization code query: app_key, app_secret, auth_code, grant_type
refreshAccessToken() Refresh access token before it expired. TiktokAccessToken tiktokAccessToken

Authorization Service authorization()

Method Description
shops() Retrieves the list of shops that a seller has authorized for an app.

Event Service event()

Method Description Parameters
webhookList() Retrieves a shop's webhooks and the corresponding webhook URLs.
updateWebhook() Updates the shop's webhook URL for a specific event topic. body: event_type, address
deleteWebhook() Deletes the shop's webhook URL for a specific event topic. body: event_type

Seller Service seller()

Method Description
shops() Retrieves all active shops that belong to a seller.

Order Service order()

Full parameters refer to API documentation

Method Description Parameters
list() Returns a list of orders created or updated during the timeframe indicated by the specified parameters. query: page_size and more
body: order_status and more
detail() Get the detailed order information of an order. query: ids
priceDetail() Get the detailed pricing calculation information of an order or a line item, including vouchers, tax, etc. params: order_id

Product Service product()

Full parameters refer to API documentation

Method Description Parameters
list() Retrieve a list of products that meet the specified conditions. query: page_size, page_token
body: status, update_time_ge and more
get() Retrieve all properties of a product that is in the DRAFT, PENDING, or ACTIVATE status. params: product_id
updateInventory() Retrieve all properties of a product that is in the DRAFT, PENDING, or ACTIVATE status. params: product_id
body: skus

Return Service return()

Full parameters refer to API documentation

Method Description Parameters
list() Use this API to retrieve one or more returns. query: page_size, page_token and more
get() Use this API to get a list of return records. params: return_id

Finance Service finance()

Full parameters refer to API documentation

Method Description Parameters
statements() Retrieve a list of statements. query: page_size, page_token and more
transactionsByOrder() Retrieve the statement transactions of an order. params: order_id
transactionsByStatement() Retrieve the statement transactions of a statement. params: statement_id
unsettledTransactions() Retrieve a list of unsettled transactions. query: page_size, page_token and more
payments() Retrieve a list of payments. query: page_size, page_token and more
withdrawals() Retrieve a list of withdrawals. query: page_size, page_token and more

Usage Examples

Basic Usage

Working with Products

Order Management

Return Order

Finance Tracking

Multi-Shop Support

By default, the package uses TIKTOK_SHOP_ID from your .env file. For multi-shop applications, specify the shop ID per request:

Error Handling

Events & Webhooks

Available Events

This package provides events that you can listen to in your application:

Event Description
Laraditz\TikTok\Events\WebhookReceived Triggered when TikTok sends webhook data
Laraditz\TikTok\Events\TikTokRequestFailed Triggered when API request fails

Creating Event Listeners

Create listeners for these events in your application:

Register the listener in your EventServiceProvider (Laravel 10 and below):

Webhook Configuration

1. Universal Webhook Endpoint

Configure this URL in your TikTok Shop App Management section under Manage Webhook to receive all webhook events:

2. Event-Specific Webhooks

You can also register individual webhooks for specific events:

3. Managing Webhooks

Read more about TikTok Webhooks in the official documentation and webhook section.

Token Management

Artisan Commands

The package provides Artisan commands for token management:

Automated Token Refresh

Set up automatic token refresh in your app/Console/Kernel.php:

Token Lifecycle

Understanding TikTok token duration:

Token Type Duration Notes
Access Token 7 days Used for API calls
Refresh Token ~2 months Used to refresh access tokens

Important: If tokens expire and refresh fails, sellers must re-authorize your app.

Testing

Running Tests

Debug Mode

Enable debug logging by listening to the TikTokRequestFailed event:

Changelog

Please see CHANGELOG for more information about recent changes.

Contributing

We welcome contributions! Please see CONTRIBUTING for guidelines on:

Security

If you discover any security vulnerabilities, please email [email protected] instead of using the issue tracker. All security vulnerabilities will be promptly addressed.

Support

Credits

License

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


All versions of tiktok with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laraditz/tiktok contains the following files

Loading the files please wait ...