> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.etera.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.etera.dev/_mcp/server.

# Post By Booking Id Apply Coupon

POST https://api.etera.dev/hotel/booking/{bookingId}/apply-coupon
Content-Type: application/json

Reference: https://docs.etera.dev/hotels/booking/hotel-booking-api/post-by-booking-id-apply-coupon

## Servers

- `https://api.etera.dev/hotel/booking` (Production, default)
- `https://api-stage.etera.dev/hotel/booking` (Staging)
- `https://api-dev.etera.dev/hotel/booking` (Development)

## Request

### Path parameters

- `bookingId` (string, required)

### Body (application/json)

This endpoint expects an object.

- `couponCode` (string, required) — The coupon code to apply to the booking

## Response

### 200

- `bookingId` (string, required)
- `hotelInfo` (BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaHotelInfo, required)
- `bookingDetails` (BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaBookingDetails, required)
- `policies` (list of any, required)
- `expiresAt` (string, required)
- `paymentOptions` (list of BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaPaymentOptionsItems, required)
- `matchHash` (string, optional)
- `paymentId` (string, optional)
- `paymentStatus` (string, optional)
- `payment` (any, optional)
- `appliedCoupon` (BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaAppliedCoupon, optional)
- `discountAmount` (double, optional)
- `totalAmount` (double, optional)

## Errors

### 400 Bad Request Error

- `success` (boolean, required)
- `error` (string, required)
- `message` (string, required)

### 401 Unauthorized Error

- `error` (string, required)
- `message` (string, required)

### 404 Not Found Error

- `success` (boolean, required)
- `error` (string, required)
- `message` (string, required)

## Types

### BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaHotelInfo

- `id` (string, required)
- `name` (string, required)
- `address` (string, required)
- `checkInTime` (string, required)
- `checkOutTime` (string, required)
- `mediaURL` (string, optional)

### BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaBookingDetails

- `checkinDate` (string, required)
- `checkoutDate` (string, required)
- `nights` (double, required)
- `roomSelections` (list of any, required)
- `guestDetails` (any, required)

### BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaPaymentOptionsItems

- `type` (string, required)
- `amount` (double, required)
- `currency` (string, required)
- `description` (string, required)
- `required` (boolean, required)
- `feeAmount` (double, required)
- `taxesAmount` (double, required)
- `isDiscounted` (boolean, required)
- `discountAmount` (double, required)

### BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaAppliedCoupon

- `code` (string, required)
- `discountType` (BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaAppliedCouponDiscountType, required)
- `discountValue` (double, required)
- `discountAmount` (double, required)
- `appliedAt` (string, required)

### BookingIdApplyCouponPostResponsesContentApplicationJsonSchemaAppliedCouponDiscountType

- "percentage"
- "fixed"

## Examples

**Request**

```json
{
  "couponCode": "string"
}
```

**Response**

```json
{
  "bookingId": "string",
  "hotelInfo": {
    "id": "string",
    "name": "string",
    "address": "string",
    "checkInTime": "string",
    "checkOutTime": "string",
    "mediaURL": "string"
  },
  "bookingDetails": {
    "checkinDate": "string",
    "checkoutDate": "string",
    "nights": 1.1,
    "roomSelections": [
      null
    ]
  },
  "policies": [
    null
  ],
  "expiresAt": "string",
  "paymentOptions": [
    {
      "type": "string",
      "amount": 1.1,
      "currency": "string",
      "description": "string",
      "required": true,
      "feeAmount": 1.1,
      "taxesAmount": 1.1,
      "isDiscounted": true,
      "discountAmount": 1.1
    }
  ],
  "matchHash": "string",
  "paymentId": "string",
  "paymentStatus": "string",
  "appliedCoupon": {
    "code": "string",
    "discountType": "percentage",
    "discountValue": 1.1,
    "discountAmount": 1.1,
    "appliedAt": "string"
  },
  "discountAmount": 1.1,
  "totalAmount": 1.1
}
```

**SDK Code**

```python
import requests

url = "https://api.etera.dev/hotel/booking/bookingId/apply-coupon"

payload = { "couponCode": "string" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.etera.dev/hotel/booking/bookingId/apply-coupon';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"couponCode":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.etera.dev/hotel/booking/bookingId/apply-coupon"

	payload := strings.NewReader("{\n  \"couponCode\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.etera.dev/hotel/booking/bookingId/apply-coupon")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"couponCode\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.etera.dev/hotel/booking/bookingId/apply-coupon")
  .header("Content-Type", "application/json")
  .body("{\n  \"couponCode\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.etera.dev/hotel/booking/bookingId/apply-coupon', [
  'body' => '{
  "couponCode": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.etera.dev/hotel/booking/bookingId/apply-coupon");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"couponCode\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["couponCode": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.etera.dev/hotel/booking/bookingId/apply-coupon")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```