DATE:
AUTHOR:
The Duffel team
API Stays

Booking creation failure webhook now available for Duffel Stays

DATE:
AUTHOR: The Duffel team

We're excited to announce a new webhook event for Duffel Stays: stays.booking_creation_failed. This webhook will fire in the rare event that a Stays booking creation returned a 202 Accepted response, before later resulting in a failure, providing you with immediate notification when a booking cannot be created.

Why is this important?

The vast majority of Stays bookings are created instantly, resulting in a 201 Created status code. However, in very rare cases, booking creation may not complete immediately due to issues with our accommodation sources. This new webhook ensures you're promptly notified in these exceptional situations, allowing you to:

  • Quickly identify and respond to failed bookings

  • Automate your error handling processes

  • Improve the overall booking experience for your customers

When does this happen?

In very rare instances, when you attempt to create a booking, you may receive a 202 Accepted status code instead of the usual 201 Created. This occurs when our accommodation sources are experiencing difficulties and require additional time to process the booking.

While we strive to resolve these situations quickly, if the booking creation ultimately fails, the stays.booking_creation_failed webhook will be triggered. This ensures you're promptly informed of the unsuccessful attempt, even in these exceptional circumstances.

Additionally we send out emails to your operations team, which your team can rely on to deliver a good customer support experience where you are not handling the webhook. You should ensure that the contact email(s) for your team is correctly set up via the Dashboard so you can receive these emails.

For testing purposes, you can use the Duffel Test Hotel to simulate a 202 Accepted response and trigger the webhook. This allows you to test your webhook handling implementation before encountering real-world scenarios.

How it works

When a booking creation fails, we'll send a webhook with the following payload:

{
  "id": "wev_0000A4tQSmKyqOrcySrGbo",
  "api_version": "v2",
  "type": "stays.booking_creation_failed",
  "data": {
    "object": {
      "quote_id": "quo_0000AS0NZdKjjnnHZmSUbI",
      "booking_creation_attempted_at": "2024-04-18T16:25:00Z"
    },
  },
  "live_mode": true,
  "idempotency_key": "F1jUeAqF0zBROjtVexfz/obDY/0=",
  "created_at": "2024-04-18T16:32:11.642000Z",
  "identity_organisation_id": "org_0000APMFjhs4X2rJ6k7UIE"
}

Key information in the payload includes:

  • The quote_id of the failed booking

  • The booking_creation_attempted_at timestamp

This information will help you identify which specific booking creation has failed.

Getting started

To start receiving these webhooks, you'll need to:

  1. Ensure your webhook endpoint is set up to receive events

  2. Update your webhook handling logic to process the new stays.booking_creation_failed event type

For more detailed information on working with webhooks, please refer to our webhooks documentation.

Powered by LaunchNotes