TGC Order API



The TGOrder endpoint enables the merchant to place international orders within TradeGlobal Commerce without going through the merchant's website. This allows merchant's to leverage TGC's functionality and ship orders internationally without going through the integration process. This functionality is typically used when the merchant is shipping internationally using TradeGlobal's ShipOrder API, or when shipping with TradeGlobal's freight accounts.

Request

TGCOrder requests are support by the HTTP POST method. Create a POST request by adding the parameters in the HTTP request entity body using the application/json media type. The request URL must conform to the following specifications:

Protocol Host Path Format
https:// services.tradeglobal.com /TGCInternalServices/MerchantServices/api/TGCOrder Json

Input Elements (Y=Yes, N=No, C=Conditional, N/A=Not Applicable)

Node Required Description Data Type Length Values
Order Y Order object containing all necessary attributes to load an order into TradeGlobal Commerce
MerchantCode Y Unique identifier for merchant String 20
MerchantOrderID Y Web Order Number assigned by the merchant String 50 Must be unique
ServiceCode Y Code indicating which shipping service to assign to the order String 50 These will be provided by TradeGlobal Commerce
PassingFreightCost N Indicates if TGC is to calculate the freight cost. If set to false, merchant will need to pass package data along with freight costs. Boolean ALWAYS SET TO FALSE
Cart Y Cart Object
ShipToAddress Y Consignee ShipToAddress Object Object
FirstName Y First name of the consignee string 50
LastName Y Last name of the consignee string 50
Address1 Y Address Line 1 string 50
Address2 N Address Line 2 string 50
City Y City string 50
StateProvince Y State or Province of the destination string 20 If a state or province is not available for the given destination, pass a whitespace.
Postal Y Postal Code of the destination string 20 If a postal code does not exist pass a whitespace or "NA"
Country Y 2-character country code of the destination string 2
Phone Y Phone number of the consignee string 50
Email Y Email Address of the consignee string 300
Products Y Array of Product objects Array
Product Y TradeGlobal/Web order number String 50
SKU Y Order reference number String 50
Quantity Y Number of products passed associated with the given SKU value Integer Must be greater than zero
UnitPrice Y Unit price for the given SKU Decimal (18,2) Must be greater than zero
Name N Name of the Product string 255
Description C Description of the Product string 255 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
HarmonizedTariffCode C Harmonized Code used for customs clearance string 15 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
CountryOfOrigin C 2-character origin country code where the product was made string 2 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
Length C Length of the product decimal(18,4) If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
Width C Width of the product decimal(18,4) If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
Height C Height of the product decimal(18,4) If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
SizeUOM C Dimensions unit of measure string 10 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary. Acceptable units (IN, CM, MM)
Weight C Weight of the product decimal(18,4) If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary. Acceptable units (IN, CM, MM)
WeightUOM C Weight unit of measure string 10 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary. Acceptable units (KG, LBS, OZ, G)
CommercialInvoiceDescription C Description of the product used for customs clearance string 50 If the SKU does not exist in the database this value is required. Once passed, the product will be saved for future requests and this value will not be necessary.
Product Y TradeGlobal/Web order number String 50

Example Request - JSON Format
POST /TGCInternalServices/MerchantServices/api/TGCOrder
HOST: services.tradeglobal.com
Content-Type: application/json
{
	"MerchantCode" : "TGCSANDBOX",
	"MerchantOrderID" : "TG0000015",
	"ServiceCode" : "GMDDP",
	"PassingFreightCost" : false,
	"Cart" : {
		"Products" : [{
			"SKU" : "TGSAND_TestSKU123",
			"Quantity" : 1,
			"UnitPrice" : 26.99,
			"Name" : null,
			"Description" : "Test SKU",
			"HarmonizedTariffCode" : "620441",
			"CountryOfOrigin" : "CN",
			"Length" : 3,
			"Width" : 6,
			"Height" : 9,
			"SizeUOM" : "IN",
			"Weight" : 0.75,
			"WeightUOM" : "LBS",
			"CommercialInvoiceDescription" : "A Test Description"
		}],
		"ShipToAddress" : {
			"FirstName" : "Bryan",
			"LastName" : "Testcase",
			"Address1" : "123 Main Street",
			"City" : "Toronto",
			"StateProvince" : "ON",
			"Postal" : "M5S 2A2",
			"Country" : "CA",
			"Phone" : "555555555",
			"Email" : "test@tgc.com"
		}
	}
}

Response

If the request is valid and authorized, the server will process the request and return a response. Each box passed in the request will be returned with a Status element indicating if the box was inserted, not processed, or failed. If a order reference does not validate or fails to process, the process will continue to process the rest of the order references in the request.

Output Elements (Y=Yes, N=No, C=Conditional, N/A=Not Applicable)

Node Required Description Data Type Length Values
OrderReferenceResponse Y Container array for one or more order references.
CreateDate Y Time Stamp of when the response was generated DateTime
OrderReferences Y Container array that holds one or more order references
Status Y Indicates if the request was successful String SUCCESS, FAILED
ErrorMessage C Message describing the error that was thrown for the given box String
MerchantCode Y Unique identifier for merchant String 20
OrderNum Y TradeGloabl/Web Order number String
RefNumber Y Reference number assigned in the request String 50
SKU C SKU associated with the given order reference String 100
Example Respone - JSON Format
200 OK
Content-Type: application/json
{
    "Status": "SUCCESS",
    "TimeStamp": "2019-02-26T14:30:45.7055122-05:00",
    "MerchantCode": "TGCSANDBOX",
    "MerchantOrderID": "TG0000015",
    "ServiceCode": "GMDDP",
    "PassingFreightCost": false,
    "Quote": {
        "QuoteID": "5e6732c2-cc55-4035-95df-a307b48be7aa",
        "CustomsField": {
            "Discount": [],
            "Fee": [
                {
                    "Amount": 0,
                    "Classification": "Custom",
                    "Type": "Brokerage"
                },
                {
                    "Amount": 0,
                    "Classification": "Custom",
                    "Type": "Disbursement"
                }
            ],
            "Total": 0
        },
        "ImportField": {
            "Discount": [],
            "Fee": [
                {
                    "Amount": 4.86,
                    "Classification": "Import",
                    "Type": "Duty"
                },
                {
                    "Amount": 1.59,
                    "Classification": "Import",
                    "Type": "VAT"
                },
                {
                    "Amount": 2.55,
                    "Classification": "Import",
                    "Type": "PST"
                }
            ],
            "Total": 9
        },
        "ServiceField": {
            "Discount": [],
            "Fee": [
                {
                    "Amount": 5,
                    "Classification": "Service",
                    "Type": "TransactionFee"
                }
            ],
            "Total": 5
        },
        "ShippingField": {
            "Discount": [
                {
                    "DiscountAmount": -12.4,
                    "Classification": "Shipping",
                    "Type": "Fixed"
                }
            ],
            "Fee": [
                {
                    "Amount": 12.4,
                    "Classification": "Shipping",
                    "Type": "Freight"
                },
                {
                    "Amount": 0,
                    "Classification": "Shipping",
                    "Type": "FuelSurcharge"
                },
                {
                    "Amount": 0,
                    "Classification": "Shipping",
                    "Type": "Insurance"
                }
            ],
            "Total": 0
        },
        "TotalCost": 53.39
    },
    "Cart": {
        "CartID": null,
        "CartTotal": 26.99,
        "Products": [
            {
                "SKU": "TGSAND_TestSKU123",
                "Quantity": 1,
                "UnitPrice": 26.99,
                "Name": null,
                "Description": "Test SKU",
                "HarmonizedTariffCode": "620441",
                "CountryOfOrigin": "CN",
                "Length": 3,
                "Width": 6,
                "Height": 9,
                "SizeUOM": "IN",
                "Weight": 0.75,
                "WeightUOM": "LBS",
                "CommercialInvoiceDescription": "A Test Description",
                "MerchantStyle": null
            }
        ],
        "ShipToAddress": {
            "FirstName": "Bryan",
            "MiddleName": null,
            "LastName": "Testcase",
            "Address1": "123 Main Street",
            "Address2": null,
            "City": "Toronto",
            "StateProvince": "ON",
            "Country": "CA",
            "Postal": "M5S 2A2",
            "Phone": "555555555",
            "Email": "test@tgc.com"
        }
    }
}