Closing a Paid Delivered Delivery Order from the API

Tags: v8preview1 v8

Starting from API V8Preview1, it became possible to close a delivery directly from the plugin.

Courier delivery can be closed by calling the method SetDeliveryCloseTime. At this point, the delivery order must be in the “Closed” status (IDeliveryOrder.Status == OrderStatus.Closed), i.e., paid. The payment for delivery orders was made earlier, which we mentioned in the note. The delivery itself must be in the “Delivered” status (IDeliveryOrder.DeliveryStatus == DeliveryStatus.Delivered). You can mark the delivery as delivered by sequentially calling the methods SetDeliveryDelivered and ChangeDeliveryActualDeliverTime.

The method takes a parameter for the delivery close time DateTime? closeTime. If this parameter is set to null, the method will change the delivery status from “Closed” back to “Delivered”.

This method does not work for self-pickup deliveries, as to close such a delivery, it simply needs to be paid for, as mentioned in the note, and returning such a delivery implies canceling the order (i.e., refunding payments), which is currently not supported from the API.