Trials and Licensing - (Windows C#)

If making use of our complete solution you’ll typically want to use our UI (if not, take a look at Silent Activation below).

To work with our trials & licenses you’ll need to have the product you want to sell created on the dashboard as an SDK product (these issue licenses).

Then it is just a case of invoking our gatekeeper product info UI when you’d like your app to be restricted:


// The default product config to honor, including a 7 day trial
PaddleProductConfig productConfig = new PaddleProductConfig
{
    ProductName = "My V2 Product",
    VendorName = "My Company",
    TrialLength = 7
};

// Create the Product we want to work with:
PaddleProduct product = PaddleProduct.CreateProduct(ProductId,
                                                    ProductType.SDKProduct,
                                                    productConfig);

// Refresh to ensure we have up to date information locally for the product.
// Remote trial values will supersede local, i.e. if the trial length has 
// been updated to 8 days, then the trial will be 8 days and not the 7 we set above.
product.Refresh((success) =>
{
    if (success)
    {
        Paddle.Instance.ShowProductAccessWindowForProduct(product);
    }
});

Verification

When working with licensing we recommend that you periodically verify activated licenses with our platform, to confirm that they are still active and valid.


if (product.Activated)
{
    product.VerifyActivation((state, errorMessage) =>
    {
        // Examine the verification state to determine the result of 
        //the verification attempt.
    })
}

Products have additional properties that will allow you to fine tune your verification frequency, properties such as LastVerifyDate and LastSuccessfulVerifiedDate

Silent Activation

If you’re making use of our licensing but want to use your own, custom UI then you’ll need to make the activation call manually and handle the result:


product.ActivateWithEmail("example@email.com",
                          "A1B2C3-D4E5F6-G7H8I9",
                          (state, errorMessage) =>
                          {
                              // Handle the activation result
                          });

Override Licensing UI

You can also override our activation UI. This will cause the SDK to use your custom window instead of the built-in Licensing Window.

To do this you need to ensure your window implements the ILicenseWindow interface and inject into the Paddle Instance by calling the following method:

Paddle.Instance.OverrideLicenseWindow<MyLicenseWindow>();

Questions about Paddle?

If you need any help regarding your Paddle integration, please get in touch with our Customer Success team using the form below.