DOCS

验证Declaration ID

运输标签 | 验证Declaration ID

检索Declaration ID的状态并自动填充海关文件

如果您创建邮政标签,当用户提供Declaration ID时,您可以调用Zonos来检索完整的海关申报详细信息。这消除了用户手动填写海关文件的需要,创建一个无缝的运输体验,其中关税已预付,海关表格自动填充。

自动填充海关申报 

按照以下步骤启用使用来自您平台的Declaration ID的自动海关申报填充。

1. 在标签创建流程中启用Declaration ID字段

在您的邮政标签创建界面中添加Declaration ID字段。当用户输入有效的Declaration ID时,您的平台可以自动填充海关申报,消除手动数据输入。

2. 查询Declaration ID状态和海关申报详细信息

使用以下查询来检索使用Declaration ID的完整海关申报数据。这在可用时返回验证状态以及项目详细信息、值、HS代码和收件人信息

1query DeclarationQuery($id: ID!) {
2 declaration(id: $id) {
3 id
4 status
5 paymentStatus
6 landedCost {
7 id
8 method
9 landedCostGuaranteeCode
10 amountSubtotals {
11 duties
12 taxes
13 fees
14 landedCostTotal
15 }
16 }
17 items {
18 id
19 sku
20 productId
21 amount
22 currencyCode
23 name
24 hsCode
25 description
26 hsCodeSource
27 countryOfOrigin
28 quantity
29 measurements {
30 type
31 value
32 unitOfMeasure
33 }
34 }
35 parties {
36 id
37 type
38 person {
39 firstName
40 lastName
41 email
42 phone
43 }
44 location {
45 id
46 line1
47 line2
48 countryCode
49 postalCode
50 }
51 }
52 }
53}

3. 处理响应并自动填充海关申报

API响应包括验证状态和海关数据。使用status信息来确定Declaration ID是否有效,然后自动填充可用的海关数据或提示手动输入。

示例响应

具有完整海关数据的有效Declaration ID:

{
  "data": {
    "declaration": {
      "id": "0mm1993s0mdcn",
      "status": "OPEN",
      "paymentStatus": "OPEN",
      "landedCost": {
        "id": "landed_cost_eabb13ab-df23-45df-9ce8-96dd29d396d1",
        "method": "DAP",
        "landedCostGuaranteeCode": "NOT_APPLICABLE",
        "amountSubtotals": {
          "duties": 0.0,
          "taxes": 0.0,
          "fees": 2.62,
          "landedCostTotal": 2.62
        }
      },
      "items": [
        {
          "id": "item_0mm199388v57g",
          "sku": "item_1",
          "productId": "item_1",
          "amount": 70.0,
          "currencyCode": "USD",
          "name": "Item 1",
          "hsCode": "9504.90.4000",
          "description": "This is the description for Item 1",
          "hsCodeSource": "TARIFF_COMPLETED",
          "countryOfOrigin": "CN",
          "quantity": 2,
          "measurements": [
            {
              "type": "WEIGHT",
              "value": 1,
              "unitOfMeasure": "POUND"
            }
          ]
        }
      ],
      "parties": [
        {
          "id": "party_0kesb32rw5hfa",
          "type": "DESTINATION",
          "person": {
            "firstName": "test",
            "lastName": "origin",
            "email": null,
            "phone": "1234567890"
          },
          "location": {
            "id": "location_c7882546-652e-49cb-81a4-98962a54c49f",
            "line1": "123 Test Street",
            "line2": "",
            "countryCode": "US",
            "postalCode": "84790"
          }
        },
        {
          "id": "party_0mjfz59bgg175",
          "type": "ORIGIN",
          "person": {
            "firstName": "test",
            "lastName": "destination",
            "email": null,
            "phone": "1234567890"
          },
          "location": {
            "id": "location_0mdzb9vk8bp7c",
            "line1": "998 Ridgehaven",
            "line2": null,
            "countryCode": "CA",
            "postalCode": "N0N 0N0"
          }
        }
      ]
    }
  }
}

4. 创建运货单

使用来自Declaration ID的自动填充数据或手动输入的声明信息来处理标签创建。

5. 将追踪号码链接到Declaration ID

创建标签后,使用declarationShipmentCreate mutation将追踪号码与Declaration ID链接,确保正确的税费支付验证和运货单追踪。

1mutation DeclarationShipmentCreate($input: DeclarationShipmentCreateInput!) {
2 declarationShipmentCreate(input: $input)
3}

您可以通过传递trackingNumbers数组和用于运货单的declarationID来创建与Declaration ID相关的运货单。

您也可以通过传递declarationID以及有关纸箱的详细信息和纸箱内的项目来创建运货单,您可以将这些信息传递到shipmentCarton中以及该纸箱的trackingNumber

GraphQL API ReferenceTypes, inputs, and operations used in this guide
预约演示

这个页面有帮助吗?