Idea
Recurring billing module consists of two parts:- an interface that allows your customers to manage subscriptions.
- a Stripe webhook endpoint that ensures that subscriptions in Stripe stay in sync with the licenses in Cryptolens.
Requirements
The webhook endpoint only requires that each subscription in Stripe has a metadata fieldskm_key_globalid set to the GlobalId of a license key. This makes it possible for Cryptolens to tell which license key should be extended or blocked based on subscription related events.
Implementation tips
The first time you set up a subscription, we recommend the following sequence of events:- Create a new subscription and add
skm_temp_varas metadata. The variable can contain anything (as long as it is not empty). - Call Create Key and record the
Key. - Call GetKey with the
KeyStringset toKey(from step 2) andProductIdset to the product that is associated with the subscription. Record theGlobalId. - Update the subscription by setting
skm_key_globalidto theGlobalId(from step 3) and removeskm_temp_varby setting it to empty string.