A powerful, lightweight, and developer-friendly Lazada API PHP SDK designed to integrate Lazada Open Platform into vanilla PHP applications, Laravel, or Symfony projects.
Easily manage Lazada OAuth authentication, automate access token generation, refresh tokens, sync products, fetch orders, and call seller APIs with minimal configuration.
Install the Lazada PHP Client via Composer:
composer require ecomphp/lazada-phpInitialize the Lazada Client using your app credentials provided by the Lazada Open Platform Console:
use EcomPHP\Lazada\Client;
$app_key = 'your_app_key_here';
$app_secret = 'your_app_secret_here';
$callback_url = 'https://your-app.com/lazada/callback';
$client = new Client($app_key, $app_secret, $callback_url);The SDK supports Lazada regions: vn, sg, my, th, ph, and id.
The SDK provides a dedicated Auth class to handle Lazada's OAuth authorization flow, access tokens, and refresh tokens.
$auth = $client->auth();Generate the authorization redirect URL for the seller to grant permissions:
$state = 'your-csrf-or-tracking-state';
$country = 'vn'; // Optional: vn, sg, my, th, ph, id
// Returns the Lazada authentication URL instead of auto-redirecting
$authUrl = $auth->createAuthRequest($state, $country, true);
// Redirect user to Lazada Authorization page
header('Location: ' . $authUrl);
exit;Once authorized, Lazada redirects the user back to your callback URL with an authorization code. Exchange it for your API tokens:
$authorization_code = $_GET['code'];
// Exchange code for Access Token & Refresh Token
$token = $auth->getToken($authorization_code);
$access_token = $token['access_token'];
$refresh_token = $token['refresh_token'];
// IMPORTANT: Save your access_token, refresh_token, and seller region to your database for later useTo make authorized calls on behalf of a specific seller, attach the access token and region to your client instance:
$access_token = 'your_stored_access_token';
$region = 'vn';
$client->setAccessToken($access_token, $region);Lazada access tokens expire. Automate token renewal using your persistent refresh_token:
$new_token = $auth->refreshNewToken($refresh_token);
$new_access_token = $new_token['access_token'];
$new_refresh_token = $new_token['refresh_token'];Note: A valid
access_tokenand sellerregionare required to interact with seller-level data.
Fetch product information from your Lazada store:
$products = $client->Product->GetProducts([
'offset' => 0,
'limit' => 50,
'filter' => 'all',
]);Retrieve a single product by Lazada item ID:
$product = $client->Product->GetProductItem('123456789');Retrieve recent orders and their order items:
$orders = $client->Order->GetOrders([
'created_after' => '2026-07-01T00:00:00+0800',
'status' => 'pending',
]);
$orderItems = $client->Order->GetOrderItems('123456789');Set order items as ready to ship:
$result = $client->Order->SetStatusToReadyToShip(
['123456789'],
'Dropshipping Provider',
'TRACKING_NUMBER'
);The client exposes Lazada API groups as resource properties, including:
SystemSellerOrderFinanceProductProductReviewStoreDecorationMediaCenterFlexicomboSellerVoucherFreeShippingReturnAndRefundFulfillmentLogisticLazadaLogisticsWalletSponsoredSolutionsServiceMarketLazLiveContent
Example:
$categoryTree = $client->Product->GetCategoryTree();
$sellerInfo = $client->Seller->GetSeller();Run the test suite with Composer:
composer testContributions, feature suggestions, and bug reports for the ecomphp/lazada-php client are highly appreciated. Feel free to open issues or submit Pull Requests!
This project is open-source software licensed under the Apache License 2.0.