How to handle upgrading of products

I have created 3 products say standard , advance and professional in cryptlex. I am having a single product and handles the relevant features using custom fields. So if a customer activates standard edition, in my java code I set the guid and activate. now if the customer wants to upgrade the product, I give him the advance edition key. But while activation it says “activation fails and guid doesnt match”

I have all three product.dat file packaged and use it java according to the edition user chooses. Is it the right way to do? how do we handle upgrading?

You should create separate products, if they are different, e.g. app1, app2 and are shipped separately (different setups)

If you have single application but with different versions say (pro, lite etc.) and they have their own setups and are shipped separately, you can create create multiple versions under a single product.

If you have single application but with different versions say (pro, lite etc.) and they are all in a single app, meaning you just enable few features in each version which makes it different from the other. then you only need one product with a single version.

You can create custom field for your version say version_type which can have three values standard , advance and professional. Suppose your customer buys standard version so at the time of key generation you set the value of version_type to standard in dashboard or using web API. When your user upgrades say to advance version, you can update the value of custom field version_type to advance in dashboard or using web API.

So, after server check occurs in your app (or you force it through ActivateProduct() call) the updated value of custom field version_type will be available in your app which you can use to determine which version to upgrade to in your app.

Your approach will also work but in your case you will need to setup a mechanism to delete old keys when user upgrades to higher version because same key cannot be used for different versions/products.

Thanks for the reply. What exactly you mean by this
“Your approach will also work but in your case you will need to setup a mechanism to delete old keys when user upgrades to higher version because same key cannot be used for different versions/products.”

Is it the key in Crytplex? or are you talking about the product.dat? How do we do that?

Suppose you generated a product key for customer X who bought standard version. If customer X now buys professional version you will need another key as professional version is a separate product. After activation of professional version key for standard version will go waste as it won’t be in use anymore due to upgrade. Hence you will need to delete the old key.

But if you use the approach mentioned in previous comment then you can reuse the same product key.