API RESTful dễ tích hợp, hỗ trợ đồng bộ đơn hàng từ Shopify và Magento chỉ trong vài bước.
Sử dụng HTTPS và OAuth 2.0 để đảm bảo an toàn dữ liệu khi truyền tải giữa các hệ thống.
Liên hệ qua Zalo hoặc email để được hỗ trợ cấu hình API trong 24h.
TingtingPOS cung cấp API RESTful để kết nối với Shopify và Magento, cho phép tạo đơn hàng và đồng bộ dữ liệu. Dưới đây là các bước cơ bản:
Lấy dữ liệu đơn hàng từ Shopify:
$shopify_url = "https://your-shop-name.myshopify.com/admin/api/2023-01/orders.json";
$headers = [
"X-Shopify-Access-Token: your_access_token",
"Content-Type: application/json"
];
$ch = curl_init($shopify_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$orders = json_decode($response, true);
Lấy dữ liệu đơn hàng từ Magento:
$magento_url = "https://your-magento-store.com/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=status&searchCriteria[filter_groups][0][filters][0][value]=pending";
$headers = [
"Authorization: Bearer your_access_token",
"Content-Type: application/json"
];
$ch = curl_init($magento_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$orders = json_decode($response, true);
Tạo đơn hàng trong TingtingPOS:
$tingtingpos_url = "https://api.tingtingpos.com/v1/orders";
$headers = [
"Authorization: Bearer your_tingtingpos_api_key",
"Content-Type: application/json"
];
$data = [
"order" => [
"customer_name" => "Nguyen Van A",
"customer_phone" => "0901234567",
"items" => [
[
"product_id" => "12345",
"quantity" => 2,
"price" => 100000
]
],
"total_amount" => 200000,
"status" => "pending"
]
];
$ch = curl_init($tingtingpos_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
echo $result['message'];