Troubleshooting
The handful of things that go wrong, and what they mean.
[coverport] \key` must be a publishable key`
Thrown synchronously by mount() or open(). The value you passed does not match pk_live_… or pk_test_…. Usually the environment variable is missing in that build, or a secret key was pasted by mistake. Never put a secret key in a browser.
[coverport] mount target not found: #insure-btn
mount() was called before the element existed. Call it after the DOM is ready, or in your framework's mounted hook. The script-tag build waits for DOMContentLoaded automatically.
The modal opens but says the key is not valid
The key format is right but CoverPort does not recognise it. Check that the key exists in the developer portal, is not frozen or deleted, and that you are not using a test key from one account with the live flow of another.
The modal is empty or shows a browser error page
Your Content Security Policy is blocking the frame. Add https://buy.coverport.io to frame-src (or child-src). If you use the script tag, https://unpkg.com must be in script-src.
onComplete never fires
- Check the browser console for a
postMessageorigin warning. The flow posts to thehostorigin the SDK passed; if your page is served from a different origin thanwindow.location.originreported at open time (for example behind a proxy that rewrites hosts), the message is dropped. - Make sure nothing on your page removes
#coverport-overlaybefore the buyer finishes. The listener is torn down with the overlay.
The button looks wrong
The SDK's .cp-button styles are minimal on purpose. Either override the class in your stylesheet or put your own markup inside the mount target and the SDK will not render a button at all.
Two modals, or the modal reopens
open() replaces any existing modal. If you see two, you have two copies of the SDK on the page, usually one from npm and one from a script tag. Pick one.
Still stuck
Email api-support@coverport.io with your publishable key, the page URL, and the browser console output.