Optional Sandbox testing

Test searches current inventory but uses Stripe test mode and simulates supplier booking, traveler email, and cancellation. It does not enable Live and is not a prerequisite for Standard production access. Never run this walkthrough with a Live key.

Return to the Live Quickstart

These walkthroughs use a separate Test key. They do not enable Live, create a real supplier booking, or send a traveler email. You do not have to complete them to obtain Standard Live access.

Optional: No-payment Test smoke path

This is the shortest linear transaction-boundary check. Use only a Test application and synthetic, non-real identity data. It searches current production hotel inventory and creates a Stripe Test payment session. Hotel Offers and Quote recheck live availability, but this path never opens payment UI, authorizes payment, calls Confirm, creates a supplier reservation, creates a refund, or creates a payout.

  1. 1

    Register and create one Test key

    With explicit workspace-owner authorization, present and integrity-check the current terms, register or sign in, list applications before creating one Test application, then list keys before creating one temporary Test key. Transfer the one-time secret directly to trusted server storage.

    Read the endpoint contract
  2. 2

    Gate the Test application

    GET capabilities first. Require application.environment=test and transactions.fullLifecycleReady=true. Stop if either check fails; never create or substitute a Live key.

    Read the endpoint contract
  3. 3

    Search current inventory

    POST Search with verified coordinates, future dates, and synthetic non-real guest data. Choose only a row that contains brekRate; traverse pagination.totalPages when a page is public-only.

    Read the endpoint contract
  4. 4

    Load Hotel Offers

    POST Hotel Offers with that row's opaque propertyId and the unchanged stay. On hotel_offers_unavailable, do not retry the stale property; use another untried brekRate row from the same Search or repeat the same Search when none remains.

    Read the endpoint contract
  5. 5

    Quote one current room

    POST Quote with one returned offers[].id and the Hotel Offers propertyId. Treat Quote price and cancellation terms as authoritative and obtain approval before creating checkout.

    Read the endpoint contract
  6. 6

    Create hosted checkout, then stop before payment

    POST one hosted checkout with a fixed Idempotency-Key and one retained serialized request body. Require environment=test, status=awaiting_payment, and payment.livemode=false. Keep action.url inside trusted code and do not open it, authorize payment, or call Confirm. Do not replay a successful response; only after an ambiguous transport result or HTTP 502, 503, or 504 may trusted code recover with the same key and byte-identical body.

    Read the endpoint contract
  7. 7

    Retrieve the checkout

    GET the returned checkout id and require the same Test checkout in awaiting_payment with no bookingReference. This read verifies recovery without crossing the payment or booking boundary.

    Read the endpoint contract
  8. 8

    Abandon and prove release

    POST the Test-only abandon operation without a body or Idempotency-Key, then GET the checkout again. Require status=expired, payment.status=voided, expiration.phase=voided, an allowed expiration.reason, and action.type=stop.

    Read the endpoint contract
  9. 9

    Revoke credentials and clean up

    If a checkout id exists after an earlier failure, attempt Test Abandon first. Public onboarding has no workspace/application deletion or console-session revoke operation. If synthetic metadata removal is desired, use authenticated support while the console session is still available. Then revoke the temporary Test key, verify its metadata is revoked and the old key no longer authenticates, and delete every local credential copy. If support cleanup is skipped, the workspace and application shells remain without an active API key.

    Read the endpoint contract

Cleanup is part of the smoke test

Run cleanup from a finally-equivalent path. If a checkout id exists, attempt the Test-only Abandon operation first. Public onboarding has no workspace deletion, application deletion, or console-session revoke operation. If synthetic metadata removal is desired, request and complete it through authenticated Partner Console support while the console session is still available. Then revoke the key, prove the old key returns 401 invalid_api_key, and delete every local secret copy. If support cleanup is skipped, the workspace and application shells remain without an active API key.

Optional: Complete Test Booking

Continue from the returned hotel through room offers, Quote, Stripe test authorization, simulated confirmation, retrieval, cancellation, refund, and commission reversal. Test uses current inventory but never creates a supplier reservation or sends traveler email.

Agent handoff

Ask your agent to run the optional Test walkthrough

This public URL is a runbook, not a sign-in link, API credential, or grant of authority. After a workspace owner explicitly authorizes the work, a browser-capable agent can follow it to create the account, separate Test application, and Test key for this optional walkthrough. The key is shown once. If the agent reads it, that secret is exposed to the agent runtime; use a trusted credential handoff to place it directly in a server-side secret manager. Without one, the agent must stop for a human to store the key and resume only after the server process receives it. Complete the Test flow and stop; a Test key cannot charge a real card or book a hotel supplier.

https://www.brek.com/agent-commerce.md

Suggested instruction: “Follow this Brek Hotel API runbook. Create a Test application and key after my explicit workspace-owner authorization. Use a trusted credential handoff; if none is available, stop for me to store the key. Then run the complete Test quickstart and report every item in the acceptance checklist below. Do not create a Live transaction.”

Optional Test acceptance checklist — integration evidence

This is client-side release evidence for the integration. Passing it does not create or enable a Live key and does not change account eligibility. The backend currently exposes no Test-completion field that gates Live eligibility; use the agreement and capabilities fields for enforced account and transaction gates. The Test run is complete only when:

  • Capabilities reports a lifecycle-ready Test application.
  • The local report records separate Quote, Confirm, and cancellation approvals, and Confirm persists a non-PII attestation bound to approvalReceipt.fingerprint.
  • Checkout reports payment.livemode=false.
  • Confirm returns environment=test, isSimulation=true, and email deliveryStatus=suppressed_in_test.
  • Retrieval returns the same confirmed simulated booking.
  • Cancellation preview returns isSimulation=true, approval.required=false, and no token.
  • Cancellation ends in status=cancelled with cancellation.refund.status=succeeded.
  • The simulated commission changes from pending to reversed.
  • A workspace owner revokes the temporary Test key in Partner Console and records that action. The script cannot revoke the credential it still needs.

approval.required=false means Test does not require the signed Live token; this walkthrough still requires a human to approve the simulated consequences.

Never use a Live cancellation as test cleanup

The Quickstart cancels its simulated Test booking only to verify servicing. A Live cancellation changes a real reservation and must never run automatically at the end of a test or retry. For Live, retrieve the booking, then create a fresh cancellation preview. Show its reason, original total, refundable amount, and penalty and obtain human approval. Live requires the five-minute token and a non-PII approval attestation bound to approval.previewFingerprint; trusted server code sends both. Never log, persist, display, share, or expose the token to a model. If the preview expires or becomes stale, discard it, preview again, present the changed consequences, and obtain approval again. After POST Cancel, if the booking becomes cancellation_in_progress, poll that booking with GET and never resubmit Cancel. For cancellation_requires_attention, an unknown outcome, or an in-progress state that does not change, stop and contact support. Report the reservation as cancelled only when status=cancelled; report a refund only when cancellation.refund.status=succeeded.

The complete Test workflow

  1. 1

    Create your Partner Console account

    Partner Console is the human UI where you create applications, issue or revoke API keys, and later inspect bookings and commissions; its server-side management API is a separate origin published by onboarding.json and onboarding OpenAPI. Standard is self-serve; no invitation, sales call, or custom contract is required. Before registration or enablement, present onboarding.json terms.previewDocumentUrl, bind acceptance to manifest.version and manifest.contentSha256, then fetch terms.canonicalTextUrl and verify those exact bytes against the digest. In production the preview is the stable canonical documentUrl. During a local predeployment Test walkthrough it is the loopback terms page; that preview never permits Live use, and an undeployed production documentUrl blocks release rather than local Test validation. A 409 agent_commerce_terms_manifest_stale response is retryable=false and includes the current manifestUrl and version: fetch that artifact again, show the current terms, and obtain fresh acceptance. Already have a B2B workspace? Sign in and choose Enable Agent Commerce—the isolated Agent setup does not change existing B2B keys, connections, markups, credit settings, or routes.

  2. 2

    Create a Test application and API key

    Use Test for this walkthrough. It searches production hotel inventory, uses Stripe test mode, and simulates the hotel supplier, cancellation, and confirmation email. The raw secret is shown once; store it in a server-side secret manager.

  3. 3

    Check capabilities and transaction readiness

    Call capabilities and require application.environment=test and transactions.fullLifecycleReady=true. Stop before checkout if either guard fails.

  4. 4

    Search hotels

    Search by location, stay dates, and guests. The response returns candidate hotels with one starting displayed Brek rate per property, but no quoteable room option; searching does not charge or book.

  5. 5

    Get room offers for one hotel

    Pass the opaque propertyId from Search in the Hotel Offers path, with the same stay and guests in the body. Search has no quoteable option ID. Hotel Offers reprices the property and returns current room types plus new B2B quoteable offer IDs. Because hotel inventory can change after Search, 409 hotel_offers_unavailable means this property is stale: try another untried Search row with brekRate, or repeat the same Search when none remains. Never silently change destination, dates, rooms, or guests.

  6. 6

    Quote the selected room

    Pass the chosen offers[].id as optionId and the Hotel Offers response propertyId as accommodation.code, with the same dates and occupancies. Never use a Search, MCP, consumer, provider, or transient source identifier. Present the exact current hotel, room, dates, pay-now amount, pay-at-property amount, traveler total, and cancellation terms. Require the traveler to type "APPROVE QUOTE" before creating checkout.

  7. 7

    Create checkout and authorize payment

    Only after Quote approval, create a hosted Test checkout. Process the entire checkout response in trusted non-model code; never serialize or log it, action.url, or payment.clientSecret. Pass the model only an explicit allowlisted non-secret summary. The sample opens a one-use local loopback URL that redirects a trusted human browser without putting the signed checkout URL in process arguments or stdout. A model-controlled browser must not inspect or drive that page. Human or browser entry belongs only in Brek-hosted checkout or Stripe.js. A trusted automated client may use Stripe's documented pm_card_visa only after proving environment=test and payment.livemode=false; never use that automation in Live. Poll with bounded backoff only while status is awaiting_payment and before expiresAt, and continue only for payment_authorized. If this Test checkout will not be confirmed, call Abandon Test checkout and require status=expired, payment.status=voided, expiration.phase=voided, an allowed expiration.reason, and action.type=stop. A newly abandoned checkout records test_checkout_abandoned; an already expired checkout preserves its first terminal reason. The operation is never available in Live.

  8. 8

    Confirm, retrieve, preview, approve, and cancel

    Payment authorization is not approval to book. Present checkout.approvalReceipt, require the distinct typed phrase "CONFIRM TEST BOOKING", and send approval with actorType=human, its timestamp, source=developer_console, a non-PII approvalRef, and the exact receiptFingerprint. Generate one confirmation Idempotency-Key and keep it fixed. On an indeterminate result, make only GET requests for the original checkout. Then preview cancellation, require separate approval, and verify the Test refund and commission reversal.

Test reference script and production guardrails

Download the complete Test script as brek-agent-test.mjs, set a Test key, and run it with Node.js 20 or later. Review the source before running it. The script response includes Content-Digest and ETag headers so trusted tooling can verify the exact downloaded bytes. It reads IDs from each response, treating every property, option, quote, checkout, and booking ID as an opaque, channel-scoped value that must be carried forward unchanged. It requires separate typed approvals before checkout, before Confirm, and before cancellation, and retains non-secret approval summaries in its final local report. For hosted payment it starts a one-use loopback redirect and opens only that local URL in the machine's default browser; the signed checkout URL never enters process arguments, stdout, or persistent storage. The complete checkout response stays in trusted non-model code; never serialize or log it, action.url, or payment.clientSecret. Give a model only an explicit allowlisted summary containing non-secret state such as id, environment, status, expiry, display labels, price totals, payment status, and action type. If automatic browser handoff fails, the script stops without printing the signed URL. In a deployed product, replace the loopback helper with a direct authenticated UI handoff; never route the signed URL through the model or let a model-controlled browser inspect or drive that page. The Brek page consumes the signed token, removes it from the browser address bar, and keeps it only in page memory.

read -rsp "Brek Test API key: " BREK_AGENT_API_KEY
printf '\n'
export BREK_AGENT_API_KEY
node brek-agent-test.mjs
unset BREK_AGENT_API_KEY

Stripe test mode is not a Live payment

The quickstart hands Brek-hosted checkout to the browser through a local one-use redirect. Human or browser entry belongs only in that hosted page or secure Stripe.js UI. Enter test payment data only there, never in model context or a Brek request. A trusted automated client may use Stripe's documented pm_card_visa only after proving environment=test and payment.livemode=false; never use that automation in Live. Payment authorization is not approval to book: the script requires CONFIRM TEST BOOKING immediately before Confirm. Confirming a Test checkout captures only a Stripe test payment, creates a simulated booking, and sends no traveler email.