API Documentation

Powerful RESTful API for seamless integration with WordPos. Enable data interoperability and business automation

API Overview

Complete, flexible, and easy-to-use API interface system

Built for Developers

WordPos API provides complete business functionality coverage, adopts RESTful design principles, supports JSON data format, allowing you to easily integrate existing systems and build custom business processes.

  • RESTful API design, easy to understand and use
  • Complete business function API coverage
  • Real-time data sync and two-way communication
  • Comprehensive error handling and status codes
  • Detailed documentation and code examples
  • Multi-language SDK support
HTTP
GET https://api.wordpos.com/v1/products
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "success": true,
  "data": [
    {
      "id": "12345",
      "name": "Product Name",
      "price": 29.99,
      "stock": 100
    }
  ],
  "pagination": {
    "page": 1,
    "total": 500
  }
}

Core Endpoints

Common API endpoints overview. For more details, please refer to the complete documentation

GET /v1/products
Get product list, supports pagination, search, filtering and other features

Request Parameters

Parameter Name Type Required Description
page Integer Optional Page number, default is 1
limit Integer Optional Items per page, default is 20
search String Optional Search keywords
category_id String Optional Category ID
POST /v1/products
Create new product

Request Parameters

Parameter Name Type Required Description
name String Required Product name
price Decimal Required Product price
barcode String Optional Product barcode
category_id String Optional Category ID
GET /v1/orders
Get order list, supports filtering by time, status, customer and other conditions

Request Parameters

Parameter Name Type Required Description
start_date Date Optional Start date
end_date Date Optional End date
status String Optional Order status
customer_id String Optional Customer ID
POST /v1/orders
Create new order

Request Parameters

Parameter Name Type Required Description
items Array Required Order item list
customer_id String Optional Customer ID
payment_method String Required Payment method
total_amount Decimal Required Order total amount
GET /v1/customers
Get customer list, supports filtering by level, points, registration time and other conditions
POST /v1/customers
Create new customer profile
GET /v1/inventory
Get inventory information, view current inventory levels and alert status
PUT /v1/inventory/{product_id}
Update product inventory quantity

Authentication

Secure and reliable API authentication mechanism

OAuth 2.0 Authentication

Adopts standard OAuth 2.0 authentication protocol to ensure API call security. Each application needs to obtain an access token to call the API.

  • 1
    Register Application: Create application in developer console, get Client ID and Client Secret
  • 2
    Get Authorization: Use Client ID and Client Secret to get access token
  • 3
    Call API: Carry Bearer Token in request header for API calls
  • 4
    Refresh Token: Use refresh token to get new access token before expiration
cURL
curl -X POST https://api.wordpos.com/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "your_client_id",
    "client_secret": "your_client_secret"
  }'

# Response example
{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "def50200..."
}

Rate Limits

Reasonable API call frequency limits to ensure stable system operation

1000
Requests per hour
100
Requests per minute
10
Concurrent connections per second
Webhook calls

Multi-language SDKs

Official SDK support makes integration simpler and faster

🐍

Python

Simple and elegant Python SDK, supports synchronous and asynchronous calls

View Documentation →

Java

Enterprise-level Java SDK with comprehensive exception handling and logging

View Documentation →
💻

JavaScript

Lightweight JS SDK, supports Node.js and browser environments

View Documentation →
🔷

C#

Modern .NET SDK, supports latest C# features

View Documentation →
📱

PHP

Lightweight PHP SDK, quickly integrates into existing projects

View Documentation →
🌐

Go

High-performance Go SDK, supports concurrency and stream processing

View Documentation →

Code Examples

Implementation examples for common scenarios, quick start

Get Product List
# Python example
from wordpos_sdk import WordPosClient

client = WordPosClient(
    client_id='your_client_id',
    client_secret='your_client_secret'
)

products = client.products.list(
    page=1,
    limit=20,
    search='phone'
)

for product in products.data:
    print(f"{product.name}: ¥{product.price}")
Create Order
// JavaScript example
const WordPos = require('wordpos-sdk');

const client = new WordPos.Client({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

const order = await client.orders.create({
  items: [
    { product_id: '12345', quantity: 2, price: 29.99 }
  ],
  payment_method: 'wechat',
  total_amount: 59.98
});

console.log('Order created successfully:', order.id);
Webhook Handling
// Java example
@PostMapping("/webhook")
public ResponseEntity handleWebhook(
    @RequestBody String payload,
    @RequestHeader("X-WordPos-Signature") String signature
) {
    if (!webhookValidator.verify(payload, signature)) {
        return ResponseEntity.status(401).build();
    }

    OrderEvent event = webhookParser.parse(payload);
    // Process order event
    return ResponseEntity.ok().build();
}
Inventory Update
# PHP example
use WordPos\WordPosClient;

$client = new WordPosClient([
    'client_id' => 'your_client_id',
    'client_secret' => 'your_client_secret'
]);

$result = $client->inventory->update('product_123', [
    'quantity' => 50,
    'operation' => 'set',
    'reason' => 'manual_adjustment'
]);

echo "Inventory updated successfully: {$result['new_quantity']}";

Getting Started

Complete API integration in 5 minutes, start your development journey

1

Register Developer Account

Visit WordPos developer platform, register developer account and complete identity verification

2

Create Application

Create new application in console, get Client ID and Client Secret

3

Get Access Token

Use API keys to get access token for subsequent API calls

4

Choose SDK

Download SDK suitable for your development language, simplify development process

5

Start Development

Refer to documentation and example code, start your API integration development