@congminh1254/shopee-sdk

中文文档
2.14.0发布于 2026/11/07MITTypeScriptES Module构建来源已验证近 30 天下载 7114

Shopee SDK maintaining by community

原始使用文档
文档目录17 节
  1. 📚 Documentation
  2. Quick Links
  3. Installation
  4. What You Get
  5. Quick Start
  6. Why Choose This SDK?
  7. 🚀 Production-Ready & Battle-Tested
  8. 💪 Complete API Coverage - All 30 Managers Implemented
  9. ✨ Developer Experience First
  10. Real-World Use Cases
  11. Migrating from Other SDKs?
  12. 🧪 Testing & Quality Assurance
  13. 1. Unit Tests
  14. 2. Live Sandbox Integration Tests
  15. Contributing
  16. Release Process
  17. License

Shopee SDK

CI Coverage Status npm version Node.js Version License: MIT

🎉 The most complete, production-ready TypeScript SDK for Shopee Open API 🎉

Buy Me a Coffee

Build powerful Shopee integrations with confidence using our fully-featured SDK that covers 100% of Shopee's API endpoints. Trusted by developers, built by the community.

📚 Documentation

Getting Started:

API Managers:

Installation

npm install @congminh1254/shopee-sdk

Requirements: Node.js >= 20.0.0

What You Get

✅ Complete TypeScript definitions for all 30 API managers
✅ Automatic token refresh and management
✅ Built-in error handling and retry logic
✅ Zero dependencies (except node-fetch)
✅ Full documentation and examples

Quick Start

Get up and running in minutes! Here's how easy it is to integrate with Shopee:

import { ShopeeSDK, ShopeeRegion } from "@congminh1254/shopee-sdk";

// 1. Initialize the SDK with your credentials
const sdk = new ShopeeSDK({
  partner_id: 123456,
  partner_key: "your-partner-key",
  region: ShopeeRegion.GLOBAL,
  shop_id: 789012, // Optional for shop-specific operations
});

// 2. Authenticate your shop (OAuth flow)
const authUrl = sdk.getAuthorizationUrl("https://your-app.com/callback");
console.log("Visit:", authUrl);

// After user authorizes, exchange code for token (automatic token storage!)
await sdk.authenticateWithCode("auth-code-from-callback");

// 3. Start using the API - it's that simple!

// Manage your products
const products = await sdk.product.getItemList({
  offset: 0,
  page_size: 20,
});

// Process orders
const orders = await sdk.order.getOrderList({
  time_range_field: "create_time",
  time_from: Math.floor(Date.now() / 1000) - 86400,
  time_to: Math.floor(Date.now() / 1000),
  page_size: 50,
});

// Track shipments
const shipping = await sdk.logistics.getShippingParameter({
  order_sn: "220615ABCDEF",
});

// Handle returns
const returns = await sdk.returns.getReturnList({
  page_size: 20,
});

// And much more - all with full TypeScript support! 🎉

That's it! The SDK handles token refresh, request signing, error handling, and more automatically.

See the Setup Guide and Authentication Guide for detailed instructions.

Why Choose This SDK?

🚀 Production-Ready & Battle-Tested

  • 100% core test coverage with 700+ robust unit & live sandbox integration tests - ensuring ultimate production reliability
  • Zero compromises - Every Shopee API endpoint is implemented and documented
  • Type-safe - Full TypeScript definitions prevent errors before they happen
  • Actively maintained - Regular updates to stay in sync with Shopee API changes

💪 Complete API Coverage - All 30 Managers Implemented

Unlike other SDKs with partial coverage, we provide complete access to every Shopee API:

Core Commerce:

  • 📦 ProductManager - Full product catalog management with 55+ endpoints
  • 🛒 OrderManager - Complete order processing and fulfillment workflow
  • 🚚 LogisticsManager - Comprehensive shipping and tracking operations
  • 💳 PaymentManager - Payment and escrow information management

Marketing & Promotions:

  • 🎟️ VoucherManager - Discount voucher campaigns
  • 💥 DiscountManager - Discount promotion campaigns
  • 🎁 BundleDealManager - Bundle deal promotions
  • ➕ AddOnDealManager - Add-on deal promotions
  • ⚡ ShopFlashSaleManager - Flash sale campaigns
  • 🎯 FollowPrizeManager - Follow prize activities
  • ⭐ TopPicksManager - Top picks product collections
  • 📣 AmsManager - Affiliate marketing solutions (AMS)

Store Management:

  • 🏪 ShopManager - Shop information and profile management
  • 🏢 MerchantManager - Merchant information, warehouses, and multi-shop management
  • 📂 ShopCategoryManager - Shop category organization
  • 🖼️ MediaManager & MediaSpaceManager - Image and video upload operations

Advanced Features:

  • 🔐 AuthManager - OAuth flow and token lifecycle management
  • 📢 PushManager - Webhooks and real-time notifications
  • 🌍 GlobalProductManager - Cross-border product management
  • 🔄 ReturnsManager - Return and refund request handling
  • 📊 AdsManager - Advertising campaign management
  • 📈 AccountHealthManager - Performance metrics and analytics
  • 🌐 PublicManager - Public API endpoints (no auth required)
  • 📍 FirstMileManager - First mile logistics operations
  • 🏭 SbsManager - Shopee Business Services warehouse inventory
  • 📦 FbsManager - Fulfillment by Shopee operations
  • 📹 LivestreamManager - Live streaming features
  • 🎬 VideoManager - Shopee Video features and analytics

✨ Developer Experience First

  • Intuitive API design - Clean, consistent interfaces across all managers
  • Automatic token refresh - Built-in token management, never worry about expiration
  • Flexible storage - File-based storage included, easy to implement custom solutions
  • Multi-region support - Works seamlessly across all 12 Shopee regions
  • Proxy support - Enterprise-ready HTTP/HTTPS proxy configuration
  • Comprehensive docs - Detailed guides and real-world examples for every feature
  • Full type safety - Complete TypeScript definitions for autocomplete and error prevention

Real-World Use Cases

This SDK is perfect for building:

  • 🏪 Multi-channel E-commerce Platforms - Sync inventory, orders, and products across multiple sales channels
  • 📊 Analytics Dashboards - Track sales performance, customer behavior, and business metrics
  • 🤖 Automation Tools - Automate order processing, inventory updates, and customer communications
  • 🔄 ERP Integrations - Connect Shopee with your existing business systems
  • 📱 Mobile Apps - Build native mobile experiences for shop management
  • 🎯 Marketing Automation - Manage promotions, vouchers, and advertising campaigns programmatically
  • 📦 Inventory Management Systems - Real-time stock tracking across warehouses
  • 🚀 Custom Storefronts - Create unique shopping experiences powered by Shopee's infrastructure

Migrating from Other SDKs?

Switching is easy! Our SDK offers:

  • More complete coverage - Every endpoint is implemented, not just the basics
  • Better TypeScript support - Full type safety from end to end
  • Simpler API - Intuitive, well-organized manager classes
  • Active maintenance - Regular updates and community support
  • Production-ready - Battle-tested with comprehensive test coverage

Check our Migration Guide to get started.

🧪 Testing & Quality Assurance

This SDK is built with reliability and correctness as first-class citizens, boasting extensive test coverage across both simulated unit environments and live external sandbox systems.

1. Unit Tests

  • Mock Manager Coverage: Over 1,160+ unit tests validating standard parameters, response layouts, request sign-generation, and error boundaries for all 30 API managers.
  • 100% Code Coverage: All core and manager logic files maintain a strict 100% statement, branch, and line code coverage.
  • Run unit tests:
    npm run test
    

2. Live Sandbox Integration Tests

Our integration test suite executes real HTTP requests against the live Shopee Sandbox environment (using dynamic OAuth credentials) to verify end-to-end integration safety:

  • Vouchers: Tests the full CRUD lifecycle (creating, fetching, updating limits, and automatically cleaning up/deleting test vouchers).
  • Media & Videos: Verifies safe transparent PNG uploads, video session initialization, and a complete chunked video upload workflow utilizing a built-in, highly-optimized 10-second Base64 MP4 H.264 video fixture.
  • Logistics & Documents: Validates thermal shipping label document generation and download jobs.
  • Payments & Settings: Checks public payment methods, shop installment profiles, active orders, local products, and dynamic Shopee server IP ranges.
  • Run sandbox integration tests:
    npm run test:sandbox
    

Contributing

We use Conventional Commits for commit messages to automate versioning and release notes.

Examples of commit messages:

  • feat: add support for logistics API - Minor version bump
  • fix: correct error handling in order API - Patch version bump
  • docs: update API documentation - No version bump
  • feat!: rename parameters in product API or feat: rename parameters in product API BREAKING CHANGE: ... - Major version bump

Release Process

This project uses Release Please to automate version management and releases.

The release process follows these steps:

  1. Commits to the main branch are automatically analyzed
  2. When conventional commit messages are detected, Release Please creates or updates a release PR
  3. When the release PR is merged:
    • A new GitHub tag and release is created
    • The package is automatically published to npm
    • The CHANGELOG.md is updated with the release notes

License

MIT

版本与发布记录

@congminh1254/shopee-sdk 共发布 49 个版本,首次发布于 2025/05/12;过去 12 个月发布了 38 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.14.0latest2026/11/073 天前
2.13.02026/11/073 天前
2.12.12026/11/064 天前
2.12.02026/10/2813 天前
2.11.02026/10/2417 天前
2.10.02026/10/1724 天前

关于 @congminh1254/shopee-sdk 的常见问题

@congminh1254/shopee-sdk 是什么?

Shopee SDK maintaining by community

如何安装 @congminh1254/shopee-sdk?

在项目目录运行 npm install @congminh1254/shopee-sdk,或使用 pnpm add / yarn add / bun add。

@congminh1254/shopee-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@congminh1254/shopee-sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@congminh1254/shopee-sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@congminh1254/shopee-sdk 可以商用吗?

@congminh1254/shopee-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@congminh1254/shopee-sdk 的下载量有多少?

根据 npm 官方下载统计,@congminh1254/shopee-sdk 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,114 次,日均约 237 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@congminh1254/shopee-sdk 还在维护吗?

最新版本 2.14.0 发布于 2026/11/07(3 天前);至今共发布 49 个版本,其中过去 12 个月发布了 38 个;首次发布于 2025/05/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。