The following functions allow you to get all the information needed to successfully render Mulberry offers.

The response objects that get returned from each method are compatible with and can be injected into the Mulberry frontend Inline, Modal and various other offers. See section "Rendering Offers" for more information.

Embedding the SDK

The first step to getting started with the Mublerry SDK is to embed the script into the <head> of your HTML

Staging:

<script src="https://app-staging.getmulberry.com/plugin/static/js/mulberry.js"></script>

Production:

<script src="https://app.getmulberry.com/plugin/static/js/mulberry.js"></script>

mulberry.core.init()

The first step to getting started with the Mulberry SDK is to embed the script and initialize it. You can do so as shown below.

async function initializeMulberry() {
  await window.mulberry.core.init({
    publicToken: '5NvkZva_L5MQ6NW8h3siiiR23z5'
  });
}

initializeMulberry();

📘

Your 'publicToken'

Make sure to use your own publicToken . You can find yours by logging into the Mulberry dashboard and clicking the settings/gear icon.

Once initialized, window.mulberry.core.settings is automatically populated with your brand colors and settings.

mulberry.core.getCoverageDetails()

You can fetch coverage details for different insurance categories.

ParemterDescription
program_idMaps directly to an insurance category at Mulberry
const coverage = await window.mulberry.core.getCoverageDetails(
	'74828474'
);

mulberry.core.getWarrantyOffer()

Fetches offers from Mulberry API in real time.

ParameterDescription
titleproduct title
idproduct SKU/id
priceproduct price
const offers = await mulberry.core.getWarrantyOffer({
  title: 'Oslo Chaise in Velvet',
  id: 'OSLO-XYZ',
  price: '2999.00',
  images: [
   'https://yoursite.com/product/526642/image1.jpg',
   'https://yoursite.com/product/526642/image2.jpg'
  ]
});

Once you have an offer returned to display, you can inject it and render it with one of our pre-built components.