Close
logo

Printing a Shipping Label

Git RepositoryEdit on Github
Last update: 2 years ago by luigi mangaReading time: 2 min

Once a rate has been selected by the user, the POST label.json endpoint is then called with the following payload. The rateId maps back to the quoteId included in the previous rates.json response. You'll also find included the same data sent in the original rates.json request (such as the shipment weight) in case this is needed in the generation of the label.

{
"rateId": "abc123",
"rate": {
"test": false,
"price": 10.55,
"quoteId": "abc123",
"provider": "Onport Provider",
"providerId": "jetti_provider",
"serviceLevel": "First Class",
"serviceLevelToken": "first_class",
"shippingIntegrationId": 1
},
"toAddress": {
"zip": "20500",
"city": "NW Washington",
"name": "Jon Bolt",
"email": "vendor@email.com",
"phone": "",
"state": "CA",
"company": "Jack Inc",
"country": "US",
"lastName": "Bolt",
"firstName": "Jon",
"addressLineOne": "1600 Pennsylvania Ave",
"addressLineTwo": null
},
"fromAddress": {
"zip": "92024",
"city": "Encinitas",
"email": "vendor@email.com",
"phone": "",
"state": "CA",
"company": "Onport dropship",
"country": "US",
"returnInHouse": true,
"addressLineOne": "1051 S Coast Hwy 101 B",
"addressLineTwo": ""
},
"dimensions": {
"width": 10.9,
"height": 1.5,
"length": 12.4,
"weight": "0.10",
"massUnit": "lb",
"distanceUnit": "in"
},
"parcelWeight": "0.10",
"orderValue": "9.99",
"iso": "USD"
}

This data can then be used to call an external service to generate a tracking number and shipping label. Onport expects the data to be returned within 20 seconds.

{
"label": {
"externalId": "abc123",
"trackingCompany": "Royal Mail",
"trackingNumber": "123ABC",
"serviceLevel": "First Class",
"serviceLevelToken": "first_class",
"price": 10.99,
"labelUrl": "http://shipping.com/label.png",
"labelFiles": ["http://shipping.com/returns.png"]
}
}
๐Ÿ“ฆ Custom Carrier โ€” Previous
Generating Rates
Next โ€” ๐Ÿ“ฆ Custom Carrier
Providing Tracking Information