How does a Return work?

When a delivery cannot be completed at the dropoff, the driver must contact the Stuart Support team to proceed. If the package has to be returned to the pickup place the support team send a “Return” to the driver.

Here is how it works on the webhook level
When the “Return” is created you will receive:

  1. A job update webhook with the status in_progress for the same original job.id
{
  "event": "job",
  "type": "update",
  "data": {
    "id": 100010902,
    "status": "in_progress",
    "comment": null,
    "pickupAt": null,
    "dropoffAt": null,
    "createdAt": "2019-11-08T10:26:33.000+01:00",
    "endedAt": null,
    "transportType": {
      "code": "bike"
    },
    "packageType": null,
    "originComment": "Ask Bobby",
    "destinationComment": "2nd floor on the left",
    "jobReference": "Order_ID#1234_1",
    "currentDelivery": {
      "id": 100011557,
      "trackingUrl": "https://stuart.sandbox.followmy.delivery/100011557/1b35de1a6acdcd2a32bdd1c09f6c64e3",
      "clientReference": "Order_ID#1234_1",
      "driver": {
        "status": "busy",
        "latitude": 48.85872,
        "longitude": 2.34761,
        "name": "Johanna Erdman Jr.",
        "firstname": "Markus",
        "lastname": "Rau",
        "phone": "+33343312785",
        "picture_path_imgix": null,
        "transportType": {
          "code": "bike"
        }
      },
      "status": "picking",
      "transportType": {
        "code": "bike"
      },
      "packageType": null,
      "etaToDestination": null,
      "etaToOrigin": null,
      "cancellation": {
        "canceledBy": "operations",
        "reasonKey": "end-customer_unreachable",
        "comment": null
      }
    },
    "deliveries": [
      {
        "id": 100011557,
        "clientReference": "Order_ID#1234_1"
      }
    ]
  }
}
  1. A delivery update webhook with the status picking for the same original delivery.id

{
  "event": "delivery",
  "type": "update",
  "data": {
    "id": 100011557,
    "trackingUrl": "https://stuart.sandbox.followmy.delivery/100011557/1b35de1a6acdcd2a32bdd1c09f6c64e3",
    "clientReference": "Order_ID#1234_1",
    "driver": {
      "status": "busy",
      "latitude": 48.85872,
      "longitude": 2.34761,
      "name": "Johanna Erdman Jr.",
      "firstname": "Markus",
      "lastname": "Rau",
      "phone": "+33343312785",
      "picture_path_imgix": null,
      "transportType": {
        "code": "bike"
      }
    },
    "status": "picking",
    "transportType": {
      "code": "bike"
    },
    "packageType": null,
    "etaToDestination": null,
    "etaToOrigin": null,
    "cancellation": {
      "canceledBy": "operations",
      "reasonKey": "end-customer_unreachable",
      "comment": null
    }
  }
}

Notice that both of the above webhooks will carry the information of what happened at the dropoff place in the cancellation attribut:

"cancellation": {
    "canceledBy": "operations",
    "reasonKey": "end-customer_unreachable",
    "comment": null
}

The possible reasonKey are the following:

  • end-customer_unreachable
  • address_error
  • package_damaged
  • end-customer_refused_package
  • cash_or_equipment_return
  • incorrect_package
  • cold_chain
  • end-customer_underaged

You are able to track the return exactly the same way as the other deliveries.
When the “Return” is completed you will receive a job status finished and a delivery status delivered

2 Likes