WidgetsPackage purchase

Package purchase widget errors

The package purchase widget logs failures to the console instead of throwing or calling back — what it logs, and how to guard for a missing container.

This widget is the odd one out: it reports failures to the console and returns rather than throwing or calling a callback. There is no onError.

What went wrongHow you see it
containerId matches nothingMedOS: Container with id '...' not found. logged; nothing renders
The client fails to initialiseMedOS: Failed to initialize client logged; nothing renders

A missing container logs, it doesn't throw

Because nothing is thrown, a try/catch around init() catches nothing. If the widget doesn't appear, open the console — that is the only place the failure is reported.

Guard the container yourself if you need to react to it:

if (!document.getElementById("medos-packages")) {
  // handle it before the widget swallows the problem
  console.error("Package container missing");
} else {
  MedosPackagePurchase.init({
    apiKey: "mk_your_publishable_key",
    containerId: "medos-packages",
  });
}

For problems that apply to every widget — a key that works on one domain but not another, a theme or font that doesn't apply — see Troubleshooting.