Integration into Your Site

Overview

This section walks through the steps to integrate the Shipium API using the Javascript Local API. The integration can be also be implemented on the server side by directly calling the API. For details on calling the Shipium API directly, see the API documentation.

Embedding and configuration

The API can be configured globally on your site or exclusively on the pages you wish to integrate with the Shipium service. These will typically be the product detail and order confirmation pages.

In summary, you will do the following:

  1. Include a script tag for the client script within the block of your website.
  2. Add a configuration block to initialize the client with your API Key.

Both of these are shown in the example below:

<head>
  <script crossorigin src="https://cdn.shipium.com/shiptime/latest/shipium.js"></script>
</head>
<body>
  <script>
    window.shipiumClient.configure({
      apiKey: 'API_KEY_PROVIDED_BY_SHIPIUM',                      // Required
      authUrl: 'https://auth.stage.shipium.com/oauth/token',      // Optional, defaults to staging
      shiptimeUrl: '<<api_url>>',  // Optional, defaults to staging
    });
  </script>
</body>