訂單 API
訂單建立
測試端點:
https://transact.ti.com/v2/store/orders/test
生產端點:
https://transact.ti.com/v2/store/orders/
訂單 API 可讓您直接透過系統建立和管理訂單。擷取詳細的訂單資訊,有效追蹤與管理。
開始之前:
- 驗證庫存和定價:建立訂單之前,請使用庫存和定價 API 確認個別品項的供貨狀況和定價。
- 啟用 API 結帳設定檔:您需要在公司帳戶中設定符合 API 資格的結帳設定檔。 有關建立帳戶和設定檔的詳細資訊,請參閱「入門」指南。
- 如果沒有結帳設定檔:請確認結帳設定檔已完成且已新增核准的付款方式(請參閱付款資訊以了解更多資訊)。
測試:
使用測試端點 (https://transact.ti.com/v2/store/orders/test) 模擬訂單建立過程和回應。請記得,此資料僅供示範之用。
訂單註解:
- 「customerOrderComments」和「customerItemComments」欄位可讓您在訂單中傳送其他資訊。
- 此資料僅供客戶使用,且未經 TI 驗證。
- 在下方範例中「customerOrderComments」陣列用於傳送豎線分隔字串陣列,以指定工作號碼與下單者的姓名。
範例:
"customerOrderComments": [
{
"message": "jobNumber|54851-50"
},
{
"message": "orderedBy|John Smith"
}]
訂單建立流程:
- 進行驗證,方法為使用指派給您的 API 金鑰和秘密。
- 使用庫存和定價 API 驗證產品供貨狀況和目前定價。
- 您會收到包含狀態程式碼 (200 OK) 的回應,以及 附有要求的產品資料的 JSON 回應。
- 在使用庫存和定價 API 確認供貨情況後,請使用所需的負載建立您的訂單,並將其發佈到訂單 API。
- 您會收到包含狀態程式碼 (201 OK) 的回應,以及確認訂單的 JSON。
#!/bin/bash
curl --request POST \
--url 'https://transact.ti.com/v2/store/orders/test' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data-binary @- <
範例回應:
{
"orderNumber": 0,
"orderStatus": "string",
"customerPurchaseOrderNumber": "string",
"subTotal": 0,
"totalPrice": 0,
"lineItems": [
{
"tiPartNumber": "string",
"tiPartDescription": "string",
"quantity": "string",
"status": "string",
"unitPrice": 0,
"customReelIndicator": true
}
],
"shippingAddress": [
{
"addressType": "string",
"firstName": "string",
"lastName": "string",
"company": "string",
"addressLine1": "string",
"addressLine2": "string",
"town": "string",
"state": "string",
"postalCode": "string",
"country": "string",
"email": "string",
"phoneNumber": "string",
"companyURL": "string"
}
],
"billingAddress": [
{
"addressType": "string",
"firstName": "string",
"lastName": "string",
"company": "string",
"addressLine1": "string",
"addressLine2": "string",
"town": "string",
"state": "string",
"postalCode": "string",
"country": "string",
"email": "string",
"phoneNumber": "string",
"companyURL": "string"
}
],
"orderMessages": [
{
"code": "string",
"type": "string",
"Message": "string"
}
],
"customerOrderComments": [
{
"message": "string"
}
],
"orderPlacedTime": "string",
"paymentType": "string",
"currencyISO": "string",
"totalTax": 0,
"checkoutProfileIdentifier": "string",
"totalDeliveryCost": 0,
"totalDiscount": 0,
"couponCodes": "string"
}