> ## Documentation Index
> Fetch the complete documentation index at: https://developers.trycents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reschedule delivery workflow

This guide walks through how to update the pickup or delivery configuration for an existing service order.
Use it when a customer needs to change their delivery window, address, or provider after an order has been placed.

#### API Endpoints Overview

* **GET /stores/:storeId/delivery-windows**: Get available delivery time slots for a new window
* **PATCH /service-order/:serviceOrderId/transportation**: Update the pickup or delivery configuration

#### Notes

Orders in `CANCELLED`, `COMPLETED`, or `EN_ROUTE_TO_CUSTOMER` status cannot be rescheduled.

### Step 1. Get an available delivery window

Use [GET /stores/:storeId/delivery-windows](/api-reference/endpoint/store/getDeliveryWindows) to fetch the new time slots you want to offer to the customer.
This is the same endpoint used during order creation. Refer to the [Create Order workflow](/documentation/order-workflow) for full details on the query parameters.

From the response, save the `id`, `startTime`, and `endTime` for the window you want to use.

```json Code Example theme={null}
{
  "ownDelivery": [{
    "id": 6622,
    "startTime": "2025-06-28T23:30:00.000Z",
    "endTime": "2025-06-29T00:00:00.000Z",
    "deliveryFeeInCents": 1000,
    "display": {
      "displayDate": "Saturday, Jun 28",
      "price": "$5.00 one way"
    }
  }]
}
```

### Step 2. Reschedule the delivery

Call [PATCH /service-order/:serviceOrderId/transportation](/api-reference/endpoint/serviceOrder/updateTransportation) with at least one of `pickup` or `delivery`.

<Tip>
  `deliveryWindow` is a pair of Unix timestamps in milliseconds: `[startTime, endTime]`. Convert the `startTime` and `endTime` values from the delivery windows response to milliseconds before sending.
</Tip>

Reschedule the return delivery only:

```json Code Sample theme={null}
{
  "delivery": {
    "type": "RETURN",
    "deliveryProvider": "OWN_DRIVER",
    "deliveryWindow": [1750000000000, 1750003600000],
    "timingsId": 6622,
    "centsCustomerAddressId": 88,
    "courierTip": 2.00,
    "thirdPartyDeliveryId": null
  },
  "paymentMethodToken": "pm_....."
}
```

Reschedule both pickup and return in one call:

```json Code Sample theme={null}
{
  "pickup": {
    "type": "PICKUP",
    "deliveryProvider": "OWN_DRIVER",
    "deliveryWindow": [1750000000000, 1750003600000],
    "timingsId": 6610,
    "centsCustomerAddressId": 88,
    "courierTip": 0,
    "thirdPartyDeliveryId": null
  },
  "delivery": {
    "type": "RETURN",
    "deliveryProvider": "ON_DEMAND",
    "deliveryWindow": [1750090000000, 1750093600000],
    "timingsId": 6671,
    "centsCustomerAddressId": 88,
    "courierTip": 2.00,
    "thirdPartyDeliveryId": null
  },
  "paymentMethodToken": "pm_....."
}
```

Cancel a scheduled delivery:

```json Code Sample theme={null}
{
  "delivery": null
}
```

> If rescheduling changes the delivery cost, include `paymentMethodToken` to cover the difference.
> If the order uses invoicing or no payment is required, you can omit it or pass `null`.

### Step 3. Handle the response

On success the API returns the updated order details. Check `orderTotal`, `pickupDeliveryFee`, and `returnDeliveryFee` to confirm the updated costs reflect the new window selection.

```json Code Example theme={null}
{
  "order": {
    "id": 101,
    "status": "SUBMITTED",
    "orderTotal": 45.00,
    "netOrderTotal": 45.00,
    "paymentStatus": "PAID",
    "pickupDeliveryFee": 5.00,
    "returnDeliveryFee": 5.00
  }
}
```
