Skip to content

Troubleshooting

Common Booking Widget problems and how to fix them.


Quick diagnosis

Symptom What to check
"Refused to frame" in the console Your page is served over http://. The widget only allows HTTPS pages to frame it — see below
Page is blank, or the iframe does not load Open the browser console. Verify the publishable key and the agency slug are correct. Confirm your CSP is not blocking frame-src
Widget says "Booking Unavailable" The publishable key is missing, wrong, or not yet issued, or the widget is switched off in the dashboard
Embed URL field is blank in the dashboard You need both a saved slug and an issued publishable key before it appears
Widget loads with the wrong branding Update the settings in the HGN dashboard. Settings are pulled live on every request — hard-refresh to clear a cached copy
Dashboard rejects your primary colour The colour fails a contrast check. Pick a mid-tone version of your brand colour
Clicking Pay shows "refused to connect" Confirm the iframe loads from book.hgn.com.np and includes allow="payment; clipboard-write"
Customer pays but never returns to your site Check that return_url is URL-encoded and uses https://. A non-HTTPS return URL is ignored silently. If no return URL is set, landing on the HGN hosted result page is expected behaviour
Console warning about sandbox escape Remove the sandbox attribute from the iframe — it must not be there. Hard-refresh if an older copy is cached

Refused to frame

Refused to frame 'https://book.hgn.com.np/' because an ancestor
violates the Content Security Policy directive: "frame-ancestors https:"

Your page is being served over plain HTTP. The widget accepts framing only from https:// pages — a booking flow that takes card payments should not be embedded by an unencrypted page.

This bites most often during local development, where http://localhost:8080 is the natural thing to reach for. Use one of the local testing approaches instead: open the widget URL directly in a tab, serve locally over HTTPS, or expose your dev server through an HTTPS tunnel.


Blank page or the iframe will not load

Work through these in order.

1. Check the browser console

Capture the full text of any error, along with anything in the Network tab that failed. HGN support will ask for both.

Look in particular for a frame-ancestors refusal — that is the HTTPS requirement, not a broken integration.

2. Verify the URL shape

The src must be exactly:

https://book.hgn.com.np/<your-slug>?mode=full&pk=<your-pk>

Common mistakes:

  • A missing or truncated publishable key — this is the one that actually breaks the widget
  • A typo in the slug, or the wrong slug entirely
  • The URL wrapped in a redirect or a proxy
  • Hand-building the URL instead of copying the Embed URL from the dashboard

The publishable key is what matters

The slug only makes the URL readable. Your agency is identified by the pk alone, so a wrong slug is harmless while a wrong key stops the widget dead with Booking Unavailable.

3. Confirm the widget is enabled

In the HGN dashboard, Booking Widget › Settings shows a badge beside the page title. If it reads Disabled rather than Live, the widget will not accept bookings — which looks the same as a broken integration from the outside. Turn the switch on in the Widget status section; if it is locked, that section lists what is still missing.

4. Check your Content Security Policy

If your site sends a CSP header, it must allow the HGN origin:

Content-Security-Policy: frame-src https://book.hgn.com.np;

A CSP block shows in the console as a message about refusing to frame the document. Merge this directive into your existing policy rather than replacing it.


Payment problems

"Refused to connect" when clicking Pay

When the customer pays, the top-level window navigates to the payment gateway — the gateway does not render inside the iframe. Two things make that possible:

  • allow="payment; clipboard-write" must be on the iframe
  • there must be no sandbox attribute on the iframe

Never add a sandbox attribute

A sandbox attribute blocks the top-level navigation the payment step depends on. It also produces console warnings about sandbox escape. Remove it entirely — do not try to fix it by adding permissions to it.

Customer pays but does not come back

If you configured a return_url:

  • It must be URL-encoded in the iframe src
  • It must use https://
&return_url=https%3A%2F%2Fyour-agency.com%2Fbooking-complete

If you did not configure one, the customer lands on the HGN hosted result page. That is expected, not a bug.

Confirmations showing for unpaid bookings

You are trusting the status query parameter. Anyone can type ?status=success in the address bar. Verify server-side — see Payment Verification.

Verification calls returning 404

If your result page verifies against book.hgn.com.np/api/public/book/payment-status/..., that endpoint does not exist and never has. It was published in error in widget 1.0.

Switch to the authenticated Partner API endpoint documented in Payment Verification.

Verification returning 400 for some bookings

Expected for multi-traveller bookings. A booking with more than one traveller creates an order group, and the payment reference cannot resolve to a single order.

There is no workaround today. Fall back to the neutral "we are confirming your payment" state, or use the HGN hosted result page, which handles groups correctly.


Layout problems

Problem Fix
Widget appears below your site header and above your footer The page is not iframe-only. Remove all page chrome — see Step 2
Widget in a narrow column with white space A wrapper, container, or max-width is constraining it. The iframe must be 100vw × 100vh with no wrapper
Two scrollbars, or the page scrolls behind the widget html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; } is missing or overridden
Broken or cut off on mobile The viewport meta tag is missing. Use width=device-width, initial-scale=1, viewport-fit=cover

On WordPress specifically, see the WordPress problems table.


Testing locally

The embedding page must be served over HTTPS, so a plain python3 -m http.server will not frame the widget. See Local testing for the three approaches that work.

Opening the HTML file directly from disk with a file:// URL is not a valid test either.

For a sandbox environment, request a sandbox publishable key from your account manager. Sandbox keys are separate from live keys.


Still stuck? Contact support

Send your HGN account manager:

  • The URL of your /insurance page
  • The full console error text, if there is one
  • A screenshot or screen recording of the problem
  • Your agency slug
  • The paymentRef, if the problem happened after payment

Expected response time: within one business day.

The console error is the most useful thing you can send

Open developer tools, reproduce the problem, and copy the complete message rather than a summary. It usually identifies the cause immediately.