Discussions

Ask a Question
Back to All

get rates is not working

`async function getShippingPriceEasyShip() {
try {

easyship.auth(easyShipSandBoxApi);
const rates = await easyship.rates_request({
courier_selection: {apply_shipping_rules: false, show_courier_logo_url: false},
destination_address: {country_alpha2: 'US'},
incoterms: 'DDU',

origin_address: {
city: "New York",
state: "NY",
postal_code: "10001",
country_alpha2: "US"
},
destination_address: {
city: "Washington",
state: "DC",
postal_code: "20500",
country_alpha2: "US"
},
incoterms: "DDU",
insurance: { is_insured: false },
parcels: [
{
items: [
{
contains_battery_pi966: true,
contains_battery_pi967: true,
contains_liquids: false,
declared_currency: "USD",
origin_country_alpha2: "US",
quantity: 11,
actual_weight: 20,
declared_customs_value: 100,
dimensions: {
length: 30,
width: 20,
height: 10,
unit: "cm"
},
category: "Electronics",
item_category_id: "12345",
hs_code: "85171200"
}
]
}
],
shipping_settings: { units: { dimensions: "cm", weight: "kg" } }

});
return rates;

} catch (error) {
    console.error('Error processing shipment update:', error);
    throw error
}

}`

This is my function my api keys are working fine,
And i have scope for rates as well
The issue is its retuning status code : 200, but response is empty

{ "data": { "rates": [], "meta": { "pagination": { "page": 1, "next": null, "count": 0 }, "request_id": "a740353a0c19e7f4a3828ac7702404d8" } }, "status": 200, "headers": {}, "res": {} }