Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

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. Prices are not returned for postpaid (debit) customers or may be returned by default.


On this page

Structure

Shipment price resource has the following attributes:

Attribute

Description

id

Shipment ID. Required when calculating prices for multiple shipments

calculated_charge_amount

Total price for the shipment.

fuel_charge_amount

Fuel fee.

notification_charge_amount

Additional notifications fee.

cod_charge_amount

COD fee.

insurance_charge_amount

Insurance fee.

calculated_charge_amount_non_commission

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:

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

Parameter

Type

Description

shipments

Array[Hash]

Contains the attributes of the shipments for which the price should be calculated.

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

  • No labels