# 更新订单状态

## 订单的状态有哪些？

| Value               | Description |
| ------------------- | ----------- |
| `pending`           | 用户还未支付成功    |
| `processing`        | 确认收款，履约订单   |
| `partially-shipped` | 部分已发货       |
| `shipped`           | 所有商品已发货     |
| `completed`         | 订单已完成       |
| `canceled`          | 订单已取消       |

<figure><img src="https://4253554051-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F78HV6e8vN6mhwsbohgTK%2Fuploads%2FeuzobqGLAwibhi60drCO%2Fimage.png?alt=media&#x26;token=66d14386-74ee-4ac6-beb4-1c1e2b088311" alt=""><figcaption></figcaption></figure>

## 如何通知客户通知订单状态的变更？

当订单的状态发生变更时，您可以通过发送order status updates 模板对客户进行通知。

例如：当订单已经发货，您可以给客户发送order status updates 的模板，发送模板时告知客户

### 创建order status updates 模板

{% hint style="info" %}
前提： 您已经完成了收款账户的绑定
{% endhint %}

1、通过接口进行创建

<https://docs.ycloud.com/reference/whatsapp_template-create>

创建的example：

<https://docs.ycloud.com/reference/whatsapp-template-creation-examples#order-status-template>

2、通过页面进行创建

访问：<https://www.ycloud.com/console/#/app/dashboard/template>

<figure><img src="https://4253554051-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F78HV6e8vN6mhwsbohgTK%2Fuploads%2FGzn2rLPek61tq7lkddvl%2Fimage.png?alt=media&#x26;token=e620bb9d-83ef-4114-a6a5-d6067a943224" alt=""><figcaption></figcaption></figure>

### 发送Order status updates消息

发送接口：<https://docs.ycloud.com/reference/whatsapp_message-send-directly>

发送的示例：

```
curl 'https://api.ycloud.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
  "from": "{{BUSINESS-PHONE-NUMBER}}",
  "to": "{{CUSTOMER-PHONE-NUMBER}}",
  "type": "template",
  "template": {
    "name": "order_status_template",
    "language": {
      "policy": "deterministic",
      "code": "en_US"
    },
    "components": [
      {
        "type": "order_status",
        "parameters": [
          {
            "type": "order_status",
            "order_status": {
              "reference_id": "<reference_id_value>",
              "order": {
                "status": "processing | partially_shipped | shipped | completed | canceled",
                "description": "<OPTIONAL_DESCRIPTION>"
              }
            }
          }
        ]
      }
    ]
  }
}'
```
