Get Rate
The Wallet endpoint allows you to get the Wallet balance details of your Gratero account.
POST
https://sandbox.gratero.com/v1/calculate-rate
Parameters
Params | Type | Mandatory | Description |
---|---|---|---|
shipment_type | string | Yes | Shipment type 'forward' or 'reverse' |
payment_mode | string | Yes | Payment method of shipment (cod or prepaid). |
pickup | integer | Yes | Pincode of warehouse address. Must be 6 digits |
delivery | integer | Yes | Pincode of customer address. Must be 6 digits |
length | integer | Yes | Length of shipment in cms. Must be more than 1 |
breadth | integer | Yes | Breadth of shipment in cms. Must be more than 1 |
height | integer | Yes | Height of shipment in cms. Must be more than 1 |
actual_weight | integer | Yes | Weight of shipment in kgs |
amount | integer | Yes | Total amount of order |
Example
Request
JSON
{
"shipment_type": "forward",
"payment_mode": "prepaid",
"pickup": 226001,
"delivery": 226011,
"length": 14,
"breadth": 11,
"height": 17,
"actual_weight": 0.56,
"amount": 200,
}
Response
JSON
{
"success": true,
"logistics": [
{
"id": 1,
"type": "surface",
"name": "Delhivery",
"chargeable_weight": "1 KG",
"freight_charges": 99.32,
"cod_charges": 0,
"total_charges": 99.32,
"zone": "A",
"edd": "1 - 3",
},
{
"id": 2,
"type": "surface",
"name": "Xpressbees",
"chargeable_weight": "1 KG",
"freight_charges": 99.32,
"cod_charges": 0,
"total_charges": 99.32,
"zone": "A",
"edd": "1 - 3",
},
],
"total_logistics": 2,
}
Code
import { Instance } from "gratero";
const gratero = new Instance({
api_key: "YOUR_API_KEY",
secret_key: "YOUR_SECRET_KEY",
environment: 'test'
});
gratero.calculateRate({
order_type: "forward",
})
.then(data => console.log(data))
.catch(error => console.log(error))