API Reference
Create a checkout session
Turn a saved Quote into its one Brek-hosted payment handoff or native payment authorization. Each Quote can create exactly one checkout.
/api/v1/agent-commerce/checkout-sessionsHeaders
Authorizationstring · required
Bearer $BREK_AGENT_API_KEY. Keep the key server-side.
Content-Typestring · required
application/json
Idempotency-Keystring · required
A unique value whose trimmed length is at least 8 characters and that identifies one logical write. The current contract publishes no maximum length or restricted character set; for portability, use a conservative ASCII UUID-like token without leading or trailing whitespace and retain its exact bytes. The key alone does not make a replay safe, and there is no universal retention promise: recovery lifetime and lookup scope are specific to the Quote, checkout session, booking, and operation. Follow the operation-specific recovery contract.
Parameters
quoteIdstring · required
quote.id returned by the Quote endpoint. The first logical create atomically reserves this Quote. Only after an ambiguous transport result or HTTP 502, 503, or 504 may trusted code recover with the same Idempotency-Key and byte-identical retained body. The key alone is not replay permission; obtain a fresh Quote for any different checkout attempt.
modehosted | native · required
Hosted opens Brek checkout. Native returns a payment client secret to the authenticated caller.
holder / occupanciesobject / array · required
Lead guest and 1–3 nonempty room occupancies used for the reservation. holder.name and holder.surName are required and must each contain at least 2 characters. Every pax requires an integer age from 0 through 120; pax name/surName are optional in the backend contract and, when supplied, must each contain at least 2 characters. Carry the exact room order and guest-age structure approved in Quote. You do not need to supply occupancyId: Brek assigns backend room IDs from that validated party. Preserve any explicit occupancyId values already supplied in Quote.
customer.emailemail · required
Traveler email used for the booking confirmation.
returnUrlabsolute URL · optional
Optional destination shown as an explicit Return to agent button after hosted authorization. Brek does not redirect automatically. The runtime requires a URL with a protocol; use HTTPS outside local development.
partnerReferencestring <= 120 characters · optional
Caller reconciliation reference. Brek generates agent-{checkoutSessionId} when omitted. It is not the Brek bookingReference and does not replace Idempotency-Key.
Request
{
"quoteId": "quote_123",
"mode": "hosted",
"holder": { "name": "Ada", "surName": "Lovelace" },
"occupancies": [{
"paxes": [{ "age": 34, "name": "Ada", "surName": "Lovelace" }]
}],
"customer": { "email": "ada@example.com" },
"partnerReference": "trip_456",
"returnUrl": "https://agent.example.com/trips/456"
}cURL
Replace every placeholder and run this from a trusted server-side environment. Never expose the API key in browser code.
curl --request POST "https://api.brek.com/api/v1/agent-commerce/checkout-sessions" \
--header "Authorization: Bearer $BREK_AGENT_API_KEY" \
--header "Idempotency-Key: $IDEMPOTENCY_KEY" \
--header "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"quoteId": "quote_123",
"mode": "hosted",
"holder": { "name": "Ada", "surName": "Lovelace" },
"occupancies": [{
"paxes": [{ "age": 34, "name": "Ada", "surName": "Lovelace" }]
}],
"customer": { "email": "ada@example.com" },
"partnerReference": "trip_456",
"returnUrl": "https://agent.example.com/trips/456"
}
JSONResponse
{
"object": "agent_commerce.checkout_session",
"id": "acs_123",
"mode": "hosted",
"environment": "test",
"status": "awaiting_payment",
"expiresAt": "<checkout expiry: ISO 8601>",
"price": {
"payNow": { "amount": 281.42, "currency": "USD" },
"payAtProperty": { "amount": 5.00, "currency": "USD" },
"travelerTotal": { "amount": 286.42, "currency": "USD" }
},
"approvalReceipt": {
"object": "agent_commerce.approval_receipt",
"version": 1,
"quoteId": "quote_123",
"issuedAt": "<receipt issue time: ISO 8601>",
"validUntil": "<quote expiry: ISO 8601>",
"hotel": {
"propertyId": "hotel_123",
"name": "Example Hotel",
"type": "Hotel"
},
"stay": {
"checkIn": "<booked check-in: YYYY-MM-DD>",
"checkOut": "<booked check-out: YYYY-MM-DD>",
"roomCodes": ["KING"],
"roomNames": ["King Room"]
},
"price": {
"payNow": { "amount": 281.42, "currency": "USD" },
"payAtProperty": { "amount": 5.00, "currency": "USD" },
"travelerTotal": { "amount": 286.42, "currency": "USD" }
},
"cancellationPolicy": {
"refundable": true,
"currency": "USD",
"deadlineTimezone": "UTC",
"cancelPenalties": [],
"summary": "Refundable with no monetary cancellation penalty currently listed."
},
"travelerSafe": true,
"partnerEconomicsIncluded": false,
"sourceQuoteFingerprint": "<opaque hash>",
"fingerprint": "<64 lowercase hex characters>"
},
"payment": {
"provider": "stripe",
"status": "requires_payment_method",
"livemode": false,
"publishableKey": "pk_test_...",
"authorizationOwner": "calling_agent_or_traveler"
},
"action": {
"type": "open_hosted_checkout",
"url": "https://www.brek.com/checkout/agent/acs_123?token=<redacted>"
}
}Native checkout response
Native mode returns the Stripe.js inputs only to the authenticated caller. Hand them directly to the traveler's secure payment UI.
{
"object": "agent_commerce.checkout_session",
"id": "acs_123",
"mode": "native",
"environment": "test",
"status": "awaiting_payment",
"expiresAt": "<expiry time: ISO 8601>",
"price": {
"payNow": {
"amount": 281.42,
"currency": "USD"
},
"payAtProperty": {
"amount": 5,
"currency": "USD"
},
"travelerTotal": {
"amount": 286.42,
"currency": "USD"
}
},
"approvalReceipt": {
"object": "agent_commerce.approval_receipt",
"version": 1,
"quoteId": "quote_123",
"issuedAt": "<receipt issue time: ISO 8601>",
"validUntil": "<quote expiry: ISO 8601>",
"hotel": {
"propertyId": "hotel_123",
"name": "Example Hotel",
"type": "Hotel"
},
"stay": {
"checkIn": "<future check-in: YYYY-MM-DD>",
"checkOut": "<future check-out: YYYY-MM-DD>",
"roomCodes": [
"KING"
],
"roomNames": [
"King Room"
]
},
"price": {
"payNow": {
"amount": 281.42,
"currency": "USD"
},
"payAtProperty": {
"amount": 5,
"currency": "USD"
},
"travelerTotal": {
"amount": 286.42,
"currency": "USD"
}
},
"cancellationPolicy": {
"refundable": true,
"currency": "USD",
"deadlineTimezone": "UTC",
"cancelPenalties": [],
"summary": "Refundable with no monetary cancellation penalty currently listed."
},
"travelerSafe": true,
"partnerEconomicsIncluded": false,
"sourceQuoteFingerprint": "quote_snapshot_123",
"fingerprint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"payment": {
"provider": "stripe",
"status": "requires_payment_method",
"livemode": false,
"publishableKey": "pk_test_...",
"authorizationOwner": "calling_agent_or_traveler",
"clientSecret": "<sensitive Stripe client secret>"
},
"action": {
"type": "confirm_payment_natively_then_confirm_booking"
}
}Response fields
idstring
Checkout session identifier used for status and confirm.
environmentlive | test
Whether payment and booking are real or simulated.
price.payNowMoney
Amount Brek will authorize and capture through Stripe. It is copied from the saved Quote for the complete stay and all requested rooms.
price.payAtPropertyMoney
Known mandatory amount paid directly to the hotel, not charged by Brek.
price.travelerTotalMoney
price.payNow + price.payAtProperty in the same currency. It excludes optional incidentals, deposits, and charges the API does not return.
approvalReceipt.priceCheckoutPrice
Authoritative approved Quote tax-and-fee breakdown frozen for this checkout. If checkout's top-level price.sourceCompleteness is false for an optional component, present approvalReceipt.price rather than inferring zero or reconstructing the value.
paymentobject
Authorization status. Native checkout creation also returns publishableKey and a one-time-delivery clientSecret for Stripe.js in the secure payment UI; ordinary status retrieval omits the client secret.
payment.livemodeboolean
Stripe mode assertion. This must be false for a Test application and true for Live.
payment.publishableKey / payment.clientSecretstring
Native Stripe.js configuration scoped to this checkout's environment. The client secret appears only in the POST create response or the documented same-key, byte-identical recovery after an ambiguous transport result or HTTP 502, 503, or 504 while checkout awaits payment; GET/status and later lifecycle responses omit it. Use the returned publishable key; do not substitute another environment's key. The client secret is sensitive and belongs only in the traveler's secure payment UI.
actionobject
The exact next step for hosted or native checkout.
Payment authorization is not a booking