自動填充海關聲明
按照下列步驟使用來自您平台的聲明 ID 啟用自動海關聲明填充。
1. 在標籤建立流程中啟用聲明 ID 欄位
在您的郵資標籤建立介面中新增聲明 ID 欄位。當使用者輸入有效的聲明 ID 時,您的平台可以自動填充海關聲明,消除手動資料輸入。
2. 查詢聲明 ID 狀態和海關聲明詳細資訊
使用以下查詢來使用聲明 ID 檢索完整的海關聲明資料。這會在可用時傳回驗證狀態以及項目詳細資訊、值、HS 代碼和收件者資訊
1
query DeclarationQuery($id: ID!) {2
declaration(id: $id) {3
id4
status5
paymentStatus6
landedCost {7
id8
method9
landedCostGuaranteeCode10
amountSubtotals {11
duties12
taxes13
fees14
landedCostTotal15
}16
}17
items {18
id19
sku20
productId21
amount22
currencyCode23
name24
hsCode25
description26
hsCodeSource27
countryOfOrigin28
quantity29
measurements {30
type31
value32
unitOfMeasure33
}34
}35
parties {36
id37
type38
person {39
firstName40
lastName41
email42
phone43
}44
location {45
id46
line147
line248
countryCode49
postalCode50
}51
}52
}53
}3. 處理回應並自動填充海關聲明
API 回應包含驗證狀態和海關資料。使用 status 資訊來判斷聲明 ID 是否有效,然後自動填充可用的海關資料或提示手動輸入。
範例回應
有效聲明 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. 建立運送
使用自動填充的聲明 ID 資料或手動輸入的聲明資訊處理標籤建立。
5. 將追蹤號碼連結到聲明 ID
在建立標籤後,使用 declarationShipmentCreate 變動來將追蹤號碼與聲明 ID 連結,確保適當的稅金支付驗證和運送追蹤。
1
mutation DeclarationShipmentCreate($input: DeclarationShipmentCreateInput!) {2
declarationShipmentCreate(input: $input)3
}您可以透過傳遞 trackingNumbers 陣列和用於運送的 declarationID 來建立與聲明 ID 繫結的運送。
您也可以透過傳遞 declarationID 並詳細說明紙箱和紙箱內的項目來建立運送,您可以在 shipmentCarton 中傳遞這些資訊以及該紙箱的 trackingNumber。
GraphQL API ReferenceTypes, inputs, and operations used in this guide
MUTATIONS
運送標籤 | 驗證聲明 ID
檢索聲明 ID 的狀態並自動填充海關文件
如果您建立郵資標籤,當使用者提供聲明 ID 時,您可以呼叫 Zonos 來檢索完整的海關聲明詳細資訊。這消除了使用者手動填寫海關文件的需要,建立了一個無縫的運送體驗,其中稅金是預付的,海關表格是自動填充的。