Generating Rates
Last update: 9 months ago by yousufdarrReading 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 Onport 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": "Onport 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 Onport 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.
Note: The quoteId
must be unique.
{"rates": [{"price": 12.55,"provider": "Onport Provider","providerId": "jetti_provider","quoteId": "sample-quote-id-1","test": false,"serviceLevel": "First Class","serviceLevelToken": "first_class"}, {"price": 10.55,"provider": "Onport Provider","providerId": "jetti_provider","quoteId": "sample-quote-id-2","test": false,"serviceLevel": "Second Class","serviceLevelToken": "second_class"}]}