訂單 API
訂單建立
測試端點:
https://transact.ti.com/v2/store/orders/test
生產端點:
https://transact.ti.com/v2/store/orders/
訂單 API 可讓您建立訂單和擷取詳細的訂單資訊。建立訂單前,您必須使用庫存與定價 API 來確認個別項目的供貨狀況。
若要下單 (測試或生產),您必須在公司帳戶中儲存符合 API 資格的結帳設定檔。如需詳細資訊,請參閱快速入門以進一步了解建立公司帳戶和結帳設定檔。若要選擇要參照您的訂單的結帳設定檔,請使用「結帳設定檔 API」。在回應中,只會傳回符合 API 資格的結帳設定檔。如果沒有結帳設定檔,請確認結帳設定檔已完成且已新增核准的付款方式 (請參閱付款資訊以了解更多資訊)。
測試端點傳回的數據會模擬生產訂單所傳回的資訊 (數據僅供示範之用,不代表已處理的數據)。準備下生產訂單時,請檢閱您希望在要求負載中傳送的所有參數,並使用 HTTP「post」動詞傳送至生產端點。
附註:欄位「customerOrderComments」和「customerItemComments」是會在訂單擷取回應中傳回的傳送文字陣列。數據僅供客戶使用,且未經 TI 驗證。在下方範例中,「customerOrderComments」陣列用於傳遞豎線分隔字串陣列,以指定工作號碼與下訂單者的姓名。
例:
"customerOrderComments": [
{
"message": "jobNumber|54851-50"
},
{
"message": "orderedBy|John Smith"
}
]
#!/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 @- <<DATA { "Orders" : { "checkoutProfileId" : "COP_ID-1234","customerPurchaseOrderNumber" : "PGR - 04202021","purchaseOrderDate" : "2020-12-31T13:56:00Z","endCustomerCompanyName" : "TI Electronics Inc","expediteShipping" : true, "customerOrderComments" : [ { "message" : "PO: 234723" }, { "message" : "my Test order" } ], "lineItems" : [ { "customerLineItemNumber" : 1, "tiPartNumber" : "ISO1042","customerPartNumber" : "CUS-SN74LS00N","customReelIndicator" : false, "quantity" : 10000, "customerItemComments" : [ { "message" : "For BOM2 - aquired " } ] }, { "customerLineItemNumber" : 2, "tiPartNumber" : "OPA33AIDR","quantity" : 10000 } ] } }
範例回應:
{ "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" }