> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lukittu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Polymart Integration

> Lukittu supports Polymart by providing a fully automatic licensing experience for your resources.

# Polymart Integration

<Note>
  Lukittu automatically delivers licenses to your customers when they purchase
  through Polymart.
</Note>

## Implementation Overview

Follow these steps to configure licensing for the products you sell using Polymart:

<Steps>
  <Step title="Create a product in Lukittu">
    First, set up your product in the Lukittu platform.
  </Step>

  <Step title="Enable the Polymart integration">
    Activate the integration in your Lukittu dashboard.
  </Step>

  <Step title="Set up a purchase webhook">
    Configure Polymart to notify Lukittu of purchase events.
  </Step>

  <Step title="Create a license placeholder">
    Set up automatic license delivery for your customers.
  </Step>
</Steps>

## Creating a Product in Lukittu

<Steps>
  <Step title="Navigate to Products">
    Go to the **Products** page in your Lukittu dashboard and click **Add
    Product**.
  </Step>

  <Step title="Add product details">
    Enter a name for your product and click **Save**.
  </Step>

  <Step title="Get the product ID">
    Open the page for your newly created product and copy the product's
    **ID**.
    <Tip>You'll need this ID when configuring your Polymart webhook.</Tip>
  </Step>
</Steps>

## Enabling Polymart Integration

Before setting up webhooks on Polymart, you need to enable the integration in your Lukittu dashboard:

<Steps>
  <Step title="Access Integrations Settings">
    Log in to your Lukittu dashboard and navigate to the **Integrations**
    tab.
  </Step>

  <Step title="Enable the Integration">
    Locate the Polymart integration option and toggle it to **Active**.
  </Step>

  <Step title="Add Integration Secrets">
    The Polymart integration requires two secrets: - **Webhook Secret:**
    You'll get this after creating your webhook on Polymart. - **Signing
    Secret:** You'll get this when setting up the license placeholder.

    <Info>
      Both secrets are required for the integration to work properly.
      You'll add them after completing the webhook and placeholder setup
      in the following steps.
    </Info>
  </Step>
</Steps>

## Setting Up Purchase Webhook

Follow these steps to configure the purchase webhook that will automatically issue licenses:

<Steps>
  <Step title="Access Polymart Product Webhooks">
    Go to your product page on Polymart and click the **Webhooks** option.
  </Step>

  <Step title="Add New Webhook">
    Click the **Add New Webhook** button to create a webhook for your
    product.
  </Step>

  <Step title="Configure Webhook Events">
    Under "What events should your webhook receive?" select **Purchases**.
  </Step>

  <Step title="Set Webhook URL">
    Enter the following URL: `         https://app.lukittu.com/api/v1/integrations/polymart?teamId=YOUR_TEAM_ID&productId=YOUR_PRODUCT_ID
                ` Replace `YOUR_TEAM_ID` with your Lukittu team's ID and
    `YOUR_PRODUCT_ID` with the Lukittu product ID you copied earlier.

    <Info>
      To find your Team ID, go to the Lukittu dashboard and navigate to
      **Team** → **Settings**.
    </Info>
  </Step>

  <Step title="Submit and Get Secret">
    Click the **Submit** button to save your webhook configuration. After
    submission, you'll receive a **webhook secret**.
  </Step>

  <Step title="Add Webhook Secret to Lukittu">
    Copy the webhook secret provided by Polymart and paste it into the
    "Webhook Secret" field in the Polymart integration section of your
    Lukittu dashboard.
  </Step>
</Steps>

## Setting Up External License Placeholder

To enable automatic license delivery to customers via placeholders, you need to set up a license placeholder in Polymart:

<Steps>
  <Step title="Access Product Security Settings">
    Go to your product's edit page on Polymart and locate the **Security**
    section.
  </Step>

  <Step title="Configure External API Placeholder">
    In the Security section, select **External API** as your custom
    placeholder type.

    <Info>
      The "Key" field can be anything you want - it's just an identifier
      for Polymart.
    </Info>
  </Step>

  <Step title="Set API Endpoint">
    Enter the following URL in the API endpoint field: `         https://app.lukittu.com/api/v1/integrations/polymart/placeholder?teamId=YOUR_TEAM_ID
                ` Replace `YOUR_TEAM_ID` with your Lukittu team ID.

    <Info>
      To find your Team ID, go to the Lukittu dashboard and navigate to
      **Team** → **Settings**.
    </Info>
  </Step>

  <Step title="Copy API Signing Secret">
    At the bottom of the card, you'll find an **API signing secret**.

    <Warning>
      Copy this secret value - you'll need to add it to Lukittu.
    </Warning>
  </Step>

  <Step title="Add Signing Secret to Lukittu">
    Return to your Lukittu dashboard's Integrations section and paste the
    API signing secret into the **Signing Secret** field of the Polymart
    integration.
  </Step>
</Steps>

### Optional License Configuration

The following query parameters can be added to your webhook URL to customize license properties:

| **Parameter**     | **Type**                   | **Description**                                                                                  |
| ----------------- | -------------------------- | :----------------------------------------------------------------------------------------------- |
| `ipLimit`         | Number                     | Maximum number of IPs allowed (must be a positive integer).                                      |
| `hwidLimit`       | Number                     | Number of concurrent users allowed (must be at least 1).                                         |
| `expirationDays`  | Number                     | Number of days until the license expires (must be at least 1).                                   |
| `expirationStart` | `ACTIVATION` or `CREATION` | Determines when expiration starts (default: `CREATION`). Applicable if `expirationDays` is used. |

Example URL with custom parameters:

```
https://app.lukittu.com/api/v1/integrations/polymart?teamId=YOUR_TEAM_ID&productId=YOUR_PRODUCT_ID&ipLimit=2&hwidLimit=1&expirationDays=30&expirationStart=CREATION
```
