Shipping Events
Shipping callback URI
When an order has been finalized, a callback will be fired to notify the merchant about the shipment. In order to listen to this callback event a 'WebhookUri' through Merchant Settings needs to be provided. This is required to be setup in advance for a merchant to be utilized.
You have to provide WebhookUri explicitly while creating an order!
- Response - Success
- Response - Success: "description"
- Response - Failure
{
"type": "shipping.created",
"description": "{\r\n \"tmsReference\": \"9184632\",\r\n \"selectedShippingOption\": {\r\n \"id\": \"BUDBEESTD\",\r\n \"carrier\": \"Budbee\"\r\n },\r\n \"shipmentSession\": {\r\n \"id\": \"3b78a322-ae63-499f-b0e8-b7c4de229c0b\",\r\n \"name\": \"Budbee\",\r\n \"description\": \"\",\r\n \"carrier\": \"budbee-home\",\r\n \"shippingFee\": 1000,\r\n \"totalShippingFee\": 1000,\r\n \"location\": null,\r\n \"fields\": [\r\n {\r\n \"id\": \"FCRECEIVERPHONE\",\r\n \"value\": \"123\\u2022\\u2022\\u2022\\u2022\\u202290\"\r\n }\r\n ],\r\n \"addons\": [],\r\n \"timeslot\": \"\",\r\n \"postalCode\": \"11251\"\r\n }\r\n}",
"orderId": 9184632
}
{
"tmsReference": "9184632",
"selectedShippingOption": {
"id": "BUDBEESTD",
"carrier": "Budbee"
},
"shipmentSession": {
"id": "3b78a322-ae63-499f-b0e8-b7c4de229c0b",
"name": "Budbee",
"description": "",
"carrier": "budbee-home",
"shippingFee": 1000,
"totalShippingFee": 1000,
"location": null,
"fields": [
{
"id": "FCRECEIVERPHONE",
"value": "123"
}
],
"addons": [],
"timeslot": "",
"postalCode": "11251"
}
}
{
"type": "shipping.failed",
"description": "{\r\n \"errorCode\": \"Error code\",\r\n \"errorMessage\": \"Error Message\"\r\n }",
"orderId": 9196729
}
Name | Description | Type | Additional Information |
---|---|---|---|
type | The type of actual webhook | String | Value would be either "shipping.created" or "shipping.failed" |
description | More information related to success or failure creating Shipping | String | Please refer to Response - Description Success/Failure tab for details |
orderId | Checkout orderId | long |
Shipping Confirmed
Subscribing to sveaCheckout:shippingConfirmed
event allows you to receive shippingConfirmation notification, when end customer choose a shipping provider in
checkout delivery options.
Subscribe
- Subscribe
- Confirm Response
- Unsubscribe
var handler = function (data) {
console.log('Shipping confirmed');
console.log(data);
}
document.addEventListener("sveaCheckout:shippingConfirmed", handler);
{
"id": "3b78a322-ae63-499f-b0e8-b7c4de229c0b",
"name": "Budbee",
"description": "",
"carrier": "budbee-home",
"shippingFee": 1000, //Minor currency
"totalShippingFee": 1000, //Minor currency
"location": null,
"fields": [
{
"id": "FCRECEIVERPHONE",
"value": "123•••••90"
}
],
"addons": [],
"timeslot": "",
"postalCode": "11251",
"price": 10,
"orderId": "9195663"
}
document.removeEventListener("sveaCheckout:shippingConfirmed", handler);
Shipping Options Retrieved
Subscribing to sveaCheckout:onDeliveryOptionsRetrieved
event allows you to receive a notification whenever Shipping module has a successful or unsuccessful attempt to display the delivery options, Merchant website can use this notification to display its own fallback solution in case of unsuccessful attempts.
If you are already providing the shipping module with a set of fallback delivery options, checkout will still display those options after an unsuccessful attempt.
Subscribe
- Subscribe
- Unsubscribe
var handler = function (data) {
console.log('Shipping Options Loaded');
}
document.addEventListener("sveaCheckout:onDeliveryOptionsRetrieved", handler);
var handler = function (data) {
console.log('Shipping Options Loaded');
}
document.addEventListener("sveaCheckout:onDeliveryOptionsRetrieved", handler);