Close
logo

Generating Rates

Git RepositoryEdit on Github
Last update: 10 months ago by Francesco de LorenziReading time: 2 min

The rates endpoint (e.g. POST /rates.json in src/index.js) returns a list of available rates for a shipment. The endpoint will be sent a payload of data, containing the address and shipment details. This endpoint is called when Jetti needs to know the available rates for a shipment. This can happen when:

  • Generating live carrier rates at checkout
  • Generating a rate for a dropship purchase, in-house purchase or return
{
"company": {
"name": "jetti-imac-1",
"email": "support@jetti.io"
},
"parcelWeight": "0.1000",
"toAddress": {
"email": "vendor@email.com",
"phone": "",
"name": "Jack Jones",
"firstName": "Jack",
"lastName": "Jones",
"addressLineOne": "1600 Pennsylvania Ave",
"addressLineTwo": null,
"city": "NW Washington",
"state": "CA",
"country": "US",
"zip": "20500",
"company": "Jack Inc"
},
"fromAddress": {
"email": "vendor@email.com",
"phone": "",
"returnInHouse": true,
"addressLineOne": "1051 S Coast Hwy 101 B",
"addressLineTwo": "",
"city": "Encinitas",
"state": "CA",
"country": "US",
"zip": "92024",
"company": "Jetti dropship"
},
"dimensions": {
"length": 12.4,
"width": 10.9,
"height": 1.5,
"distanceUnit": "in",
"massUnit": "lb",
"weight": "0.10"
},
"orderValue": 9.99,
"iso": "USD"
}

This data can then be used to query external carrier integrations to return back to Jetti a list of available rates. A response must be received in 20 seconds. Multiple rates can be returned if needed, by passing in additional items in the rates array.

{
"rates": [{
"price": 10.55,
"provider": "Jetti Provider",
"providerId": "jetti_provider",
"quoteId": "abc123",
"test": false,
"serviceLevel": "First Class",
"serviceLevelToken": "first_class"
}]
}
๐Ÿ“ฆ Custom Carrier โ€” Previous
Introduction
Next โ€” ๐Ÿ“ฆ Custom Carrier
Printing a Shipping Label