---
title: "สร้างคำสั่งซื้อ | Tajo"
description: "ซิงค์คำสั่งซื้อ ecommerce กับ Brevo เพื่อคำนวณคะแนนสะสมและสร้างการมีส่วนร่วมกับลูกค้า"
url: https://tajo.io/th/docs/ecommerce-loyalty/orders/create-order/
markdown: https://tajo.io/th/docs/ecommerce-loyalty/orders/create-order.md
lang: th-TH
author: "Set Noa"
author_url: https://tajo.io/th/set-noa/
robots: noindex
---

ขอสิทธิ์ใช้งานล่วงหน้า

กรอกชื่อและที่อยู่อีเมลที่ทำงานของคุณ เราจะส่งลิงก์เพื่อยืนยันคำขอเข้าใช้งาน Tajo ทางอีเมล

# สร้างคำสั่งซื้อ

[Set Noa](https://tajo.io/th/set-noa/)

ซิงโครไนซ์คำสั่งซื้อ ecommerce กับ Brevo เพื่อคำนวณคะแนนสะสมโดยอัตโนมัติ อัปเดตระดับสมาชิกของลูกค้า และทริกเกอร์แคมเปญการตลาดแบบเฉพาะบุคคล

## เริ่มต้นใช้งาน

### การสร้างคำสั่งซื้อพื้นฐาน

```http
POST https://api.brevo.com/v3/ecommerce/orders
Content-Type: application/json
api-key: YOUR_API_KEY

{
  "id": "ORD-2024-001",
  "email": "customer@example.com",
  "billing": {
    "address": "123 Main St",
    "city": "New York",
    "country": "US",
    "phone": "+1234567890"
  },
  "products": [
    {
      "id": "PROD-123",
      "name": "Premium Widget",
      "quantity": 2,
      "price": 149.99,
      "category": ["Electronics", "Gadgets"]
    }
  ],
  "revenue": 309.97,
  "date": "2024-01-25T14:30:00Z"
}
```

### การตอบกลับ

```json
{
  "id": "ORD-2024-001",
  "created": true,
  "loyaltyPointsAwarded": 310
}
```

## การเชื่อมต่อระบบคะแนนสะสมของ Tajo

### คำสั่งซื้อพร้อมการคำนวณคะแนนสะสม

```json
{
  "id": "ORD-2024-001",
  "email": "customer@example.com",
  "customerId": "CUST-12345",
  "loyaltyId": "LYL-2024-001",

  "billing": {
    "name": "John Doe",
    "address": "123 Main St",
    "city": "New York",
    "state": "NY",
    "country": "US",
    "zipCode": "10001",
    "phone": "+1234567890"
  },

  "shipping": {
    "name": "John Doe",
    "address": "456 Oak Ave",
    "city": "Brooklyn",
    "state": "NY",
    "country": "US",
    "zipCode": "11201",
    "method": "Standard Shipping",
    "cost": 9.99
  },

  "products": [
    {
      "id": "PROD-123",
      "name": "Smart Watch Pro",
      "variant": "Black/42mm",
      "sku": "SW-PRO-BLK-42",
      "quantity": 1,
      "price": 299.99,
      "category": ["Electronics", "Wearables"],
      "brand": "TechBrand",
      "loyaltyPointsEarned": 300,
      "loyaltyMultiplier": 1.0
    },
    {
      "id": "PROD-456",
      "name": "Wireless Charger",
      "sku": "WC-FAST-01",
      "quantity": 1,
      "price": 49.99,
      "category": ["Electronics", "Accessories"],
      "loyaltyPointsEarned": 50,
      "loyaltyMultiplier": 1.0
    }
  ],

  "financial": {
    "subtotal": 349.98,
    "shipping": 9.99,
    "tax": 28.00,
    "discount": 35.00,
    "total": 352.97,
    "currency": "USD",
    "paymentMethod": "Credit Card",
    "paymentStatus": "Completed"
  },

  "loyalty": {
    "pointsEarned": 353,
    "bonusPoints": 50,
    "pointsMultiplier": 1.2,
    "tierBefore": "Silver",
    "tierAfter": "Gold",
    "tierUpgraded": true,
    "totalPointsBalance": 2853,
    "couponUsed": "SAVE10",
    "couponDiscount": 35.00
  },

  "metadata": {
    "source": "Website",
    "campaign": "Summer Sale",
    "referrer": "Google Ads",
    "userAgent": "Mobile App",
    "firstPurchase": false,
    "returningCustomer": true
  },

  "date": "2024-01-25T14:30:00Z",
  "status": "Completed"
}
```

## ฟีเจอร์คะแนนสะสมขั้นสูง

### คำสั่งซื้อที่ได้โบนัสวันเกิด

```json
{
  "loyalty": {
    "pointsEarned": 200,
    "birthdayBonus": 500,
    "bonusReason": "Birthday Month",
    "totalBonusPoints": 500,
    "pointsMultiplier": 2.0,
    "specialOffer": "Double Points Week"
  }
}
```

### คำสั่งซื้อจากการแนะนำเพื่อน

```json
{
  "loyalty": {
    "pointsEarned": 150,
    "referralBonus": 250,
    "referredBy": "CUST-67890",
    "referralCode": "REF-FRIEND50",
    "firstPurchaseBonus": 100
  },
  "metadata": {
    "isReferralOrder": true,
    "referralSource": "Friend Referral"
  }
}
```

### คำสั่งซื้อแบบสมัครสมาชิก

```json
{
  "subscription": {
    "id": "SUB-2024-001",
    "type": "Monthly",
    "frequency": 30,
    "nextBilling": "2024-02-25",
    "isRecurring": true
  },
  "loyalty": {
    "pointsEarned": 100,
    "subscriptionBonus": 50,
    "loyaltyMultiplier": 1.1
  }
}
```

## หมวดหมู่สินค้าสำหรับคะแนนสะสม

### ตัวคูณคะแนนตามหมวดหมู่

```json
{
  "products": [
    {
      "id": "PROD-LUXURY-001",
      "category": ["Luxury", "Fashion"],
      "loyaltyMultiplier": 2.0,
      "loyaltyPointsEarned": 400
    },
    {
      "id": "PROD-ECO-001",
      "category": ["Eco-Friendly", "Sustainable"],
      "loyaltyMultiplier": 1.5,
      "loyaltyBonus": "Eco Warrior"
    }
  ]
}
```

## การอัปเดตสถานะคำสั่งซื้อ

### การจัดส่งคำสั่งซื้อ

```json
{
  "id": "ORD-2024-001",
  "status": "Shipped",
  "tracking": {
    "number": "TRK123456789",
    "carrier": "UPS",
    "url": "https://tracking.ups.com/TRK123456789"
  },
  "fulfillment": {
    "date": "2024-01-26T10:00:00Z",
    "warehouse": "NYC-01",
    "method": "Ground Shipping"
  }
}
```

### การปิดคำสั่งซื้อ

```json
{
  "id": "ORD-2024-001",
  "status": "Delivered",
  "delivery": {
    "date": "2024-01-28T16:30:00Z",
    "signature": "Customer",
    "location": "Front Door"
  },
  "loyalty": {
    "reviewIncentive": 25,
    "reviewIncentiveExpiry": "2024-02-28"
  }
}
```

## การประมวลผลคำสั่งซื้อแบบกลุ่ม

สร้างคำสั่งซื้อหลายรายการพร้อมกันสำหรับการซิงค์แบบกลุ่ม:

```json
{
  "orders": [
    {
      "id": "ORD-2024-001",
      "email": "customer1@example.com",
      "products": [...],
      "revenue": 199.99
    },
    {
      "id": "ORD-2024-002",
      "email": "customer2@example.com",
      "products": [...],
      "revenue": 299.99
    }
  ]
}
```

## การจัดการข้อผิดพลาด

```json
{
  "code": "duplicate_order",
  "message": "Order ID already exists",
  "details": {
    "orderId": "ORD-2024-001",
    "existingDate": "2024-01-25T14:30:00Z"
  }
}
```

```json
{
  "code": "invalid_customer",
  "message": "Customer email not found",
  "details": {
    "email": "unknown@example.com",
    "suggestion": "Create contact first"
  }
}
```

## การเชื่อมต่อ Webhook

ตั้งค่า Webhook เพื่อซิงค์การเปลี่ยนแปลงสถานะคำสั่งซื้อ:

```json
{
  "webhookUrl": "https://your-tajo-app.com/webhooks/brevo",
  "events": [
    "order.created",
    "order.updated",
    "order.shipped",
    "order.delivered",
    "loyalty.points.awarded"
  ]
}
```

## แนวปฏิบัติที่ดีสำหรับ Tajo

1. **ซิงค์แบบเรียลไทม์**: สร้างคำสั่งซื้อทันทีหลังจากลูกค้าชำระเงินเสร็จ
2. **ข้อมูลครบถ้วน**: ใส่ข้อมูลทุกอย่างที่เกี่ยวข้องกับคะแนนสะสม
3. **อัปเดตสถานะ**: รักษาสถานะคำสั่งซื้อให้เป็นปัจจุบันเพื่อการติดตามที่แม่นยำ
4. **การกู้คืนเมื่อเกิดข้อผิดพลาด**: จัดการคำสั่งซื้อซ้ำและลูกค้าที่ไม่พบอย่างเหมาะสม
5. **การคำนวณคะแนน**: ตรวจสอบว่าการคำนวณคะแนนสะสมตรงกับระบบของคุณ
6. **การแบ่งกลุ่มลูกค้า**: ใช้ข้อมูลคำสั่งซื้อเพื่อทำแคมเปญแบบเจาะกลุ่ม

## การวิเคราะห์และการรายงาน

ติดตามตัวชี้วัดสำคัญ:

- แนวโน้มมูลค่าคำสั่งซื้อ
- อัตราการแลกคะแนนสะสม
- มูลค่าตลอดช่วงชีวิตของลูกค้า
- รูปแบบการเลื่อนระดับสมาชิก
- ประสิทธิภาพของแคมเปญ

## ขั้นตอนถัดไป

- อัปเดตสถานะคำสั่งซื้อ
- ตั้งค่าโปรแกรมสะสมคะแนน
- กำหนดกฎการให้คะแนน
- สร้างหมวดหมู่สินค้า
