Documentation

Delivery cost calculation

Scope: catalog Permissions to execute: for all

JSON query schema:


{
	"$id":"/schemas/webhooks/calculate/request.json",
	"$schema":"http://json-schema.org/draft-07/schema",
	"title":"Calculate delivery price schema",
	"required":[
		"SHIPMENT"
	],
	"type":"object",
	"properties":{
		"SHIPMENT":{
			"$ref":"../../shipment.json"
		}
	}
}

Example:

{
    SHIPMENT: {
        ID: 354,
        DELIVERY_SERVICE: {
            ID: 716,
            CONFIG: [
                {
                    CODE: "PROFILE_TYPE",
                    VALUE: "TAXI",
                }
            ],
            PARENT: {
                ID: 715,
                CONFIG: [
                    {
                        CODE: "SETTING_1",
                        VALUE: "SETTING_1 value",
                    },
                    {
                        CODE: "SETTING_2",
                        VALUE: "SETTING_2 value",
                    },
                ],
            },
        },
        PRICE: 99999.99,
        CURRENCY: "GBP",
        WEIGHT: 230,
        PROPERTY_VALUES: [
            {
                ID: 451,
                TYPE: "ADDRESS",
                VALUE: {
                    LATITUDE: "51.507625620491",
                    LONGITUDE: "-0.12546300888062",
                    FIELDS: {
                        POSTAL_CODE: "WC2N 5NS",
                        COUNTRY: "United Kingdom",
                        ADM_LEVEL_1: "England",
                        LOCALITY: "Westminster",
                        STREET: "Craven Street",
                        BUILDING: "10",
                        ADDRESS_LINE_1: "Craven Street, 10",
                    },
                },
            },
            {
                ID: 452,
                TYPE: "ADDRESS",
                VALUE: {
                    LATITUDE: "51.511995991646",
                    LONGITUDE: "-0.13612747192383",
                    FIELDS: {
                        POSTAL_CODE: "W1F 9UH",
                        COUNTRY: "United Kingdom",
                        ADM_LEVEL_1: "England",
                        LOCALITY: "Westminster",
                        STREET: "Great Pulteney Street",
                        BUILDING: "33-34",
                        ADDRESS_LINE_1: "Great Pulteney Street, 33-34",
                    },
                },
            },
            {
                ID: 453,
                TYPE: "STRING",
                VALUE: "some comment",
            },
        ],
        ITEMS: [
            {
                NAME: "Apple xs 128gb",
                PRICE: 99999.99,
                WEIGHT: 230,
                CURRENCY: "BGP",
                QUANTITY: 1,
                DIMENSIONS: {
                    WIDTH: "5",
                    HEIGHT: "5",
                    LENGTH: "20",
                },
            }
        ],
        EXTRA_SERVICES_VALUES: [
            {
                ID: 1034,
                CODE: "cargo_type",
                VALUE: "small_package",
            },
            {
                ID: 1033,
                CODE: "door_delivery",
                VALUE: "Y",
            },
        ],
        RESPONSIBLE_CONTACT: null,
        RECIPIENT_CONTACT: null,
    }
}

Example of response with successful delivery cost calculation:

{
    SUCCESS: "Y",
    PRICE: 79.99,
}

Example of response with calculation cost error:

{
    "SUCCESS": "N",
    "REASON": {
        "TEXT": "Delivery is not available for the specified address"
    }
}


© «Bitrix24», 2001-2024