CargoLabs Docs

Quickstart

Add a quote button to a page in under five minutes.

1. Get a publishable key

Sign in to the developer portal, open API Keys, and create a key. You will get a pk_test_… key for integration work and a pk_live_… key for production. Read Keys for what each one can and cannot do.

2. Install

npm install @coverport/js
insure.js
import coverport from '@coverport/js';

coverport.mount('#insure-btn', {
  key: 'pk_test_…',
  onComplete: (sale) => {
    // Reconcile the sale on your side.
    console.log('CoverPort sale', sale.purchaseId, sale.amountTotal);
  },
});
page.html
<div id="insure-btn"></div>

3. Try it

Load the page and click the button. With a pk_test_ key the modal shows a Test mode badge and test sales never charge a real card.

4. Go live

Swap the key for your pk_live_… key. Nothing else changes.

Keep secret keys out of the browser

The SDK throws if you pass anything other than a pk_live_ or pk_test_ key. Secret keys for the REST API belong on your server only.

Next steps

On this page