[1.23.0] Shipment price calculation

Warning!

Resource available only in the following countries: PL

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.

Warning debit clients!

After creating a shipment we do not return prices for debit clients. The rate attribute is null



On this page

 

Structure

Shipment price resource has the following attributes:

AttributeDescriptionAvailability
idShipment ID. Required when calculating prices for multiple shipmentsPL
calculated_charge_amountTotal price for the shipment.PL
fuel_charge_amountFuel fee.PL
notification_charge_amountAdditional notifications fee.PL
cod_charge_amountCOD fee.PL
insurance_charge_amountInsurance fee.PL
calculated_charge_amount_non_commissionFee 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.PL

Resource example in JSON format:

[
    {
		"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

POST /v1/organizations/:organization_id/shipments/calculate

Parameters

ParameterTypeDescriptionAvailability
shipmentsArray[Hash]Array of Shipment objectsPL

Example request

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

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:

[
    {
        "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."
    }
]