# Integration

After you’ve developed your app, go to the [Author Dashboard](https://poshtrader.com/author-dashboard) and add a product you will be integrating licensing to. You will need to do three things:

1. Save the product as a draft
2. Note the **ID** for the product at the top of page
3. Add licensing into your assembly, compile and upload files

{% hint style="info" %}
**The product ID** is the identifier of your product which is to be used in the code.
{% endhint %}

## **Adding the licensing library to your app**

You will need to download the [Licensing library](https://jiribeloch.gitbook.io/poshtrader-help-center/developer/licensing-library) and add it as a reference in your app.

```csharp
using PoshTrader.Licensing;
```

## Validate licensing library origin

External libraries might be a subject of tampering by hackers to work around the licensing infrastructure. It's a good practice to validate its origin by comparing the code signature and making sure it hasn't tampered before executing any functions.

```csharp
var assembly = Assembly.GetAssembly(typeof(ItemLicense));
var certificate = X509Certificate.CreateFromSignedFile(assembly.Location);
if (certificate.GetCertHashString() != "07FF85A977EF497368AA1ADEB64D43B2B55BD4D8")
{
    throw new Exception("Could not validate 'PoshTrader.Licensing' assembly origin.");
}
```

{% hint style="warning" %}
This doesn't apply to the **cTrader platform** and trying to validate its origin using the method above won't work.
{% endhint %}

## **Add item attributes**

Those attributes serve as important data during communication with our licensing server. Make sure that these attributes are correct, and the version is up to date.

```csharp
[Item(ID, "Sample Indicator", Version = "1.0.0", Author = "John Doe")]
```

## **Create item license object**

At the beginning of your app life cycle, you need to create an item license object where you pass your main class object with item attributes as a parameter.

```csharp
var license = new ItemLicense(this);
```

## **Verify license validation**

The next thing you need to do is to check the license status. If the license is not valid, then a window will pop out asking for [License Activation](https://jiribeloch.gitbook.io/poshtrader-help-center/products/license-activation). If the user fails to validate his purchase, you will want to terminate the app or take some other action.

```csharp
if (!license.IsValid())
    return;
```

### Check if the user is running a trial period

Optionally, you might want to check if the user is running the [Free 7-day trial](https://jiribeloch.gitbook.io/poshtrader-help-center/products/license-activation/free-trial) and make some features not available or limited to demo trading accounts only.

```csharp
if (license.IsTrial())
{
    // limited features
}
else
{
    // all features
}
```

{% hint style="info" %}
You can do these checks as often and as many times as you need. The license validation process is done on the background asynchronously and syncs the status with our servers periodically.
{% endhint %}
