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

> ## Agent Instructions
> This site documents the D-EDGE APIs for technology partners (web agencies, OTAs, PMS and RMS vendors, booking and CRM tools). It is written for developers integrating with hotels that use the D-EDGE platform.
> Seven APIs, grouped by domain. Connectivity: Channel Manager API (distribute a hotel's inventory to your channel and send bookings back). Pricing & Availability: Best Price API (best offers to highlight), Quotation API (all bookable offers for a stay), Daily Rates API (daily availability between two dates). Booking: Booking Engine API (a hotel's full direct booking funnel), Gift Shop API (gift vouchers from catalogue to payment). Guest Management: CRM API (guest profiles).
> Pick the API by the need: to display prices, use the Best Price API or the Daily Rates API; to quote a specific stay, use the Quotation API; to book, use the Booking Engine API; to sell gift vouchers, use the Gift Shop API; to manage guest profiles, use the CRM API; to receive hotel inventory and send bookings back as a distribution channel, use the Channel Manager API.
> Base URLs, hotel identifiers, and credentials are delivered by the D-EDGE partnership team during onboarding. Do not invent base URLs, endpoints, parameters, or example credentials that do not appear on these pages.
> Authentication differs per API: OAuth 1.0 for Best Price, Quotation, Daily Rates, and Booking Engine; an X-API-KEY header for Gift Shop; OAuth 2.0 client credentials for CRM; partner-defined credentials carried in the XML message for the Channel Manager API. Read each API's Authentication page before writing code.
> A mock environment returns realistic but fictitious data without credentials. The Postman and Insomnia collections on the API collections page target it by default. Use it for exploration and tests, never for production traffic.
> Use the official names exactly: D-EDGE, D-EDGE platform, Channel Manager API, partnership team. Do not use Back Office or Extranet.
> Each API has a Changelog page. Check it for the current behaviour before relying on an older answer. For questions these pages do not answer, direct the reader to the Contact us page.

# Last-step discount

> Apply an exceptional discount to the basket at the quote step, before payment

A reservation agent sometimes needs to grant a one-off discount that no configured offer covers: a goodwill gesture, a price match, or an incentive to close the booking, applied right before the guest pays. The **Get a quote** endpoint accepts two headers that apply this exceptional discount to the current basket and return the discounted totals.

## Prerequisites

Before applying a discount, make sure you have:

* A session with a basket that holds at least one room. If not, follow the [Quick start](/booking-engine-api/get-started/quick-start.md), then [add a room to the basket](/booking-engine-api/build/reference/basket/post-basket-rooms.md).
* The OAuth 1.0 signing setup from the [Quick start](/booking-engine-api/get-started/quick-start.md).
* The discount mode and value your internal rules allow.

## How it works

The **Get a quote** endpoint (`GET /v2/{sessionId}/quote`) quotes the current basket. Two optional headers apply an exceptional discount on top of that price:

* `X-AVP-DiscountCalculationMode`: how the discount is calculated.
* `X-AVP-DiscountValue`: the amount or percentage to apply.

The calculation mode takes one of these values:

| Mode | `X-AVP-DiscountValue` | Effect |
| - | - | - |
| `Nominal` | A fixed amount | Takes that amount off the basket total |
| `Percentage` | A percentage | Takes that percentage off the whole basket |
| `PercentageWithoutExtras` | A percentage | Takes that percentage off the rooms only, leaving extras at full price |

The quote response carries the result in `sellingConditions.discount`, alongside the recomputed totals:

```json theme={null}
"discount": {
  "name": "Discount",
  "description": "20 € off the stay",
  "calculationMode": "Nominal",
  "discountAmount": {
    "converted": { "text": "20 €", "value": { "amount": 20, "currency": "EUR" } },
    "original": { "text": "24 USD", "value": { "amount": 24, "currency": "USD" } }
  },
  "isPublic": true
}
```

`name` and `description` are set by the API and cannot be changed: they carry a generic label, so treat them as read-only and do not depend on their exact wording. `discountAmount` gives the discount in both the requested display currency (`converted`) and the original currency before conversion (`original`).

The discount you apply at this step is passed on to the D-EDGE platform and the connected PMS, where it appears as a generic exceptional-discount line.

> [!NOTE]
>
> The discount is applied on each call to **Get a quote**, not stored on the session. Send the headers again on the final quote the guest accepts, so the total they confirm is the discounted one. See [Re-quote right before confirmation](/booking-engine-api/build/best-practices.md#re-quote-right-before-confirmation).

## Apply the discount

> [!NOTE]
>
> The examples reuse the OAuth 1.0 signing setup from the [Quick start](/booking-engine-api/get-started/quick-start.md). Replace `{sessionId}` with the session you created.

```bash cURL theme={null}
curl --request GET \
  --url 'https://{apiBaseUrl}/v2/{sessionId}/quote' \
  --header 'Authorization: OAuth ...' \
  --header 'X-AVP-DiscountCalculationMode: Nominal' \
  --header 'X-AVP-DiscountValue: 20'
```

```javascript Node.js theme={null}
const url = "https://{apiBaseUrl}/v2/{sessionId}/quote";

const response = await fetch(url, {
  method: "GET",
  headers: {
    ...oauth.toHeader(oauth.authorize({ url, method: "GET" }, token)),
    "X-AVP-DiscountCalculationMode": "Nominal",
    "X-AVP-DiscountValue": "20",
  },
});

const quote = await response.json();
const discount = quote.sellingConditions?.discount;
```

```python Python theme={null}
response = session.get(
    "https://{apiBaseUrl}/v2/{sessionId}/quote",
    headers={
        "X-AVP-DiscountCalculationMode": "Nominal",
        "X-AVP-DiscountValue": "20",
    },
)

quote = response.json()
discount = quote.get("sellingConditions", {}).get("discount")
```

```php PHP theme={null}
$response = $client->get('v2/{sessionId}/quote', [
    'headers' => [
        'X-AVP-DiscountCalculationMode' => 'Nominal',
        'X-AVP-DiscountValue'           => '20',
    ],
]);

$quote = json_decode($response->getBody(), true);
$discount = $quote['sellingConditions']['discount'] ?? null;
```

```csharp C# theme={null}
var request = new RestRequest("/v2/{sessionId}/quote", Method.Get);
request.AddHeader("X-AVP-DiscountCalculationMode", "Nominal");
request.AddHeader("X-AVP-DiscountValue", "20");

var response = await client.ExecuteAsync(request);
var quote = JsonDocument.Parse(response.Content!).RootElement;
var discount = quote.GetProperty("sellingConditions").GetProperty("discount");
```

```java Java theme={null}
HttpGet request = new HttpGet("https://{apiBaseUrl}/v2/{sessionId}/quote");
request.setHeader("X-AVP-DiscountCalculationMode", "Nominal");
request.setHeader("X-AVP-DiscountValue", "20");
consumer.sign(request);

JsonNode quote;
try (CloseableHttpResponse response = client.execute(request)) {
    quote = mapper.readTree(EntityUtils.toString(response.getEntity()));
}
JsonNode discount = quote.path("sellingConditions").path("discount");
```

Read `sellingConditions.discount` to confirm the discount applied, and the recomputed `totalAmount` and `balanceAmount` to display the new price.

## Tips

* **Cap the discount and gate large ones**. Enforce your own maximum and an approval step before sending a high `X-AVP-DiscountValue`. The API applies whatever you send, so the guardrail is yours to build.
* **Log every discount**. Record the mode, the value, and who approved it. An audit trail turns a later dispute into a quick lookup.
* **Re-quote before payment**. Prices and availability move while the guest fills in their details. Send the discount headers again on the final quote so the confirmed total matches what the guest agreed to.

## Related

> **[Get a quote](/booking-engine-api/build/reference/basket/get-quote.md)**
>
> Full schema for the quote endpoint and its headers.

> **[Best practices](/booking-engine-api/build/best-practices.md)**
>
> Session, funnel, and resilience patterns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.