Stripe Integration
This guide covers typical scenarios in which Stripe integrates with LicenseSpring.
Follow these steps to configure licensing for products that you sell using Stripe:
- Create product in LicenseSpring platform
- Create product in Stripe dashboard
- Add custom attributes to the product price metadata
- Add webhook endpoint
- Add restricted api key from Stripe to LicenseSpring platform account
- Generate license keys

Product short code will be used to identify Stripe products with products defined in LicenseSpring.
All default products fields from LicenseSpring will be used as default license fields if no custom attributes are saved in Stripe product price metadata.
On your Stripe dashboard go to Products -> Add product.

As a part of a product creation process in Stripe, you need to create a price for this product. If you select Recurring billing type, LicenseSpring integration will create subscription license type and use billing period from price settings as a valid duration in LicenseSpring. If you select One time billing type, LicenseSpring will use products default license type value or custom price attribute to set license type in LicenseSpring.

Click on Save product button in the top right corner of the screen to finish creating a product in Stripe.
To properly create licenses LicenseSpring will use product price metadata custom attributes. To add attributes to the price metadata, go to Product page and select the price which you want to customize.


For every product in the LicenseSpring platform you can define one or many license policies which act as a template when creating licenses. License policy can be added to the Stripe products as a price metadata key license_policy with value of some license policy code. When order is being created via Stripe, our integration will take all the fields, product features and custom fields from included license policy and create the license based on those.
If license_policy attribute is not included Stripe integration will use default license policy for the product to create a license.
In case of subscription license_type will be always set as subscription and valid_duration period will use billing period from product price settings.
Custom attributes are used to overwrite fields from license policy and to handle some specific use cases which license policies don't cover. Note that short_code attribute is always required.
- short_code - required. Add the product short code you configured LicenseSpring product with.
- max_activations- optional, INT. If this field is not included, the default from the product configuration in LicenseSpring will be used.
- floating_cloud - optional, INT. If this value is set licenses from this product will be created as floating cloud. This value also sets the total number of machines / users that can concurrently use a floating cloud license ( Max simultaneous license users value in LicenseSpring configuration ). Needs to be less than or equal to max activations attribute value.
- license_type - optional, STRING. If this field is not included, the default license type from the product configuration in LicenseSpring is used (perpetual, time-limited, subscription, consumption). For recurring product prices license type is always subscription.
- valid_duration - optional, STRING. If this field is not included, the default valid_duration from the product configuration in LicenseSpring is used. The format for this is N[d/w/m/y] where N is number and option between d,w,m,y is possible (day, week, month, year - ex. "1y").Not applicable for subscription licenses.- subscription licenses will use billing period from product price settings.
- enable_maintenance_duration - optional, BOOL. turns on maintenance capability. If not defined, default from LicenseSpring is used.
- maintenance_duration - optional, STRING behaves same as the valid_durationfield.
- max_license_users - optional, INT, limits the number of users which can be added to the licenses -. example: one license with multiple license users. Can be added only for products with user authorization method
- is_license_manager - optional, BOOL, sets customer as a license manager. Useful on license-key based products where customer is not set as a license manager per default. If you are creating user based licenses, but do not want the customer to be assigned as a license manager, set this as false
- assign_customer_as_user - optional, BOOL, customer will be automatically assigned to the license as a license user. Can be added only for products with user authorization method
3.2.1 Single License
In your store, user can select different quantities for a product. Default behaviour is that multiple quantities will result in multiple licenses (both user and license-key based!). If instead, when user selects >1 quantity you want to make a SINGLE license that can be activated multiple times (for license-key based) or a SINGLE license that supports multiple users (for user-based licenses), you need to add this custom attribute: is_single_license- optional, BOOL
Single license product price inside the subscription cannot be replaced later with multiple license product price.

Create as many product price variations as you want. For example if you want to bundle a product with maintenance period and charge it more, create a new price, add related custom attributes to it and LicenseSpring integration will use them to create licenses based on that.
3.2.2 Max Simultaneous License Users From Quantity on a Single License
In case of single floating-cloud license, quantity can be used to determine max simultaneous license users instead of max_activations for license-key based or number of users for user based products. To enable this, please use this following combination of custom attributes on the product price:
floating_users_from_quantity : true
floating_cloud : 1
max_activations - optional, INT. If this field is not included, the default from the product configuration in Licensespring will be used.
LicenseSpring will listen to some events sent from Stripe to create orders and licenses in the platform. To enable this you need to create a Stripe webhook which will send those events to LicenseSpring server.
To create a webhook go to Developers -> Webhooks and click on Add endpoint button.

Webhook URL: https://api.licensespring.com/api/stripe?uuid={your_uuid_from_LS_platform}
To access your LS uuid key, go to LicenseSpring platform account -> Account Settings -> Keys and copy your key.

Select this events from the Events dropdown on webhook endpoint modal:
- customer.subscription.created ( order and licenses will be created in LicenseSpring )
- customer.subscription.deleted ( licenses from the subscription will be deactivated )
- customer.subscription.updated ( licenses from the subscription will be updated with new values ( quantity, policy and trial changes ) )
- invoice.payment_succeeded ( on successful payment licenses will be prolonged with new Expiration date written in license validity_period field )
All webhook events from Stripe are stored as "License history" and available in the platform as a "history log" for each license. This history log can be found under the "Usage report" for a license.
LicenseSpring needs limited access to your Stripe account to update Subscription metadata after order is created and to fetch and copy Customer from Stripe to LicenseSpring.
To enable this create restricted API key in your Stripe dashboard. Go to Developer -> API keys and click on a Create restricted key button.

The title of this key can be anything you like, but we recommend something relating to LicenseSpring. Set all permissions to Read except Subscriptions, Invoices and Stripe CLI permissions which need to be set to Write.
Save this key and add it to the LicenseSpring account by going to Account Settings -> Preferences. Copy the key to the Stripe secret key text field and click on the Save changes button.

License keys are generated only for products with license-key authorization method.
There are currently two ways how you can create licenses keys which will be then used for licensing your products.
If Stripe API will be used to create subscriptions, attach the generated license keys to the subscription metadata. LicenseSpring integration will use those keys to create licenses in the LicenseSpring platform. More about Stripe API subscriptions methods here: https://stripe.com/docs/api/subscriptions/create
To generate licenses please use this generate_licenses endpoint from our Management API https://docs.licensespring.com/docs/generate-license-key (OLD LINK)
Metadata format { "metadata": { "license_keys": { "{short_code_here}": ["G8HA-SRRZ-A6WK-TJWB", "GCUE-JSUQ-4X2K-P7PR"], "{if_more_products_another_short_code}": ["G8HA-SRRZ-A6WK-TJWA"] } } }
Instead of {short_code_here} placeholders add a product short code for which you want to use those license keys.
If you are creating Stripe subscriptions and invoices ( in case of one time order, ex. perpetual licenses ) manually without the ability to create the subscription or invoice with prefilled metadata then LicenseSpring will detect that metadata doesn't contain keys for the product in question and it will generate them automatically. Upon order create is finished, subscriptions / invoice metadata on Stripe will be updated with those license keys.
To access them you can subscribe your application to Stripe customer.subscription_updated event in case of a subscription or invoice.updated event in case of a one time order.
Alternatively you can fetch the subscription or invoice afterwards using Stripe API.
License keys will be visible on Stripe dashboard on metadata section of the created subscription / invoice.

To send the license keys automatically to your customers user our Email notification policies to create and customize preferred email notifications.
LicenseSpring integration with Stripe supports subscription with single products only.