Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The resource is responsible for calculating shipment prices without the necessity of creating them. Multiple shipments can be sent and each one will have a price returned.
Info |
---|
Warning debit clients! After creating a shipment we do not return prices for debit clients. The |
On this page
Table of Contents |
---|
Structure
Shipment price resource has the following attributes:
Attribute | Description |
---|---|
| Shipment ID. Required when calculating prices for multiple shipments |
| Total price for the shipment. |
| Fuel fee. |
| Additional notifications fee. |
| COD fee. |
| Insurance fee. |
| Fee calculated on the basis of the parcel sender's price list (PRICE) and it determines the Amount without charged Margins for optional services - This amount comes directly from the size of the shipment. |
Resource example in JSON format:
Code Block | ||
---|---|---|
| ||
[ { "id": "SHIPMENT1", "calculated_charge_amount": "27.20", "fuel_charge_amount": "0.00", "notification_charge_amount": "0.00", "cod_charge_amount": "0.00", "insurance_charge_amount": "20.00", "calculated_charge_amount_non_commission": "7.20", }, { "id": "SHIPMENT2", "calculated_charge_amount": "18.00", "fuel_charge_amount": null, "notification_charge_amount": null, "cod_charge_amount": null, "insurance_charge_amount": null, "calculated_charge_amount_non_commission": null, } ] |
Authentication
Access to the resource requires a valid access token.
Calculating shipment prices
Code Block | ||
---|---|---|
| ||
POST /v1/organizations/:organization_id/shipments/calculate |
Parameters
Parameter | Type | Description |
---|---|---|
| Array[Hash] | Contains the attributes of the shipments for which the price should be calculated. |
Example request
Code Block | ||
---|---|---|
| ||
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/shipments/calculate -H 'Authorization: Bearer token' -H 'content-type: application/json' -d ' { "shipments": [ { "id": "SHIPMENT1", "receiver": { "email": "receiverrro32969504293051@example.com", "phone": "329695042", "first_name": "John Receiver32969504293051", "last_name": "Mc'Receiver32969504293051", "address":{ "line1":"Ulica jakaś32969504293051", "line2":"Budynek32969504293051", "city":"Szczecin32969504293051", "post_code":"00-001", "country_code":"PL" } }, "parcels": { "dimensions": { "length": "50", "width": "50", "height": "50", "unit": "mm" }, "weight": { "amount": "5", "unit": "kg" } }, "custom_attributes": { "target_point": "KRA010" }, "insurance": { "amount": 25, "currency": "PLN" }, "cod": { "amount": 10, "currency": "PLN" }, "service": "inpost_locker_standard" }, { "id": "SHIPMENT2", "receiver": { "email": "receiverrro32969504293051@example.com", "phone": "329695042", "first_name": "John Receiver32969504293051", "last_name": "Mc'Receiver32969504293051", "address":{ "line1":"Ulica jakaś32969504293051", "line2":"Budynek32969504293051", "city":"Szczecin32969504293051", "post_code":"00-001", "country_code":"PL" } }, "parcels": { "dimensions": { "length": "50", "width": "50", "height": "50", "unit": "mm" }, "weight": { "amount": "5", "unit": "kg" } }, "custom_attributes": { "target_point": "KRA010" }, "insurance": { "amount": 25, "currency": "PLN" }, "cod": { "amount": 10, "currency": "PLN" }, "service": "inpost_courier_standard" } ] } |
Response
Code Block | ||
---|---|---|
| ||
HTTP/1.1 200 OK Content-Type: application/json [ { "id": "SHIPMENT1", "calculated_charge_amount": "27.20", "fuel_charge_amount": "0.00", "notification_charge_amount": "0.00", "cod_charge_amount": "0.00", "insurance_charge_amount": "20.00", "calculated_charge_amount_non_commission": "7.20", }, { "id": "SHIPMENT2", "calculated_charge_amount": "18.00", "fuel_charge_amount": null, "notification_charge_amount": null, "cod_charge_amount": null, "insurance_charge_amount": null, "calculated_charge_amount_non_commission": null, } ] |
In case of the logistics system not returning a price for the data sent an error message will be returned for a single shipment:
Code Block | ||
---|---|---|
| ||
[ { "id": "SHIPMENT1", "calculated_charge_amount": "27.20", "fuel_charge_amount": "0.00", "notification_charge_amount": "0.00", "cod_charge_amount": "0.00", "insurance_charge_amount": "20.00", "calculated_charge_amount_non_commission": "7.20" }, { "id": "SHIPMENT2", "key": "no_offers", "message": "External logistic system responded with no offers." } ] |