Skip to content

bgmorton/blicense

Repository files navigation

blicense

node-js-licensefile + express + stripe


About

  • This NodeJS/Express Application accepts payment for, and generates a node-js-licensefile compatible software license
  • It provides a text download of the generated license with invoice details, stores the results in a database, and emails a copy to the customer
  • It can apply discounts for each additional month the duration of the software license is for, encouraging users to invest in your product
  • Optional single tax rate for sales in your region - For example, GST can be added for Australian buyers only if you are operating from Australia and must charge tax there
  • It's great for selling licenses for electron apps using node-js-licensefile for validating licenses
  • It's intended to be run behind a reverse-proxy which would add it's own HTTPS - and as such DOES NOT SUPPORT HTTPS
  • You should really run this behind a HTTPS reverse proxy or add HTTPS support yourself, otherwise it won't be secure

Screenshot

  • Screenshot

Requirements

  • MySQL Server
  • SMTP Email Host
  • Account and API keys with Stripe.com payments processor
  • Server running NodeJS > 8 to host this code
  • Reverse http proxy - Apache, Nginx etc.

App Behaviour

  • Startup
    • Database will automatically migrate, creating a licenses table
    • If the database cannot connect on start, it will retry indefinitely, logging each failure
  • General
    • Logo will display if process.env.LOGO=true
    • Http Errors will be sanitized when process.env.NODE_ENV=production
  • Route /
    • Displays main payment form
    • Will display process.env.DESCRIPTION under optional logo
    • process.env.PRODUCT_PAGE_LINK, process.env.TERMS_PAGE_LINK buttons appear below the pricing table
    • Tax will be added to total if the users country matches process.env.STRIPE_GST_COUNTRY
    • Pricing table populated from process.env. vars, tax/discount pricing table rows will be hidden if 0
    • Both validation and Stripe payment errors will appear above the Submit Payment button
    • Total is re-calculated on form value change
    • Discount will be automatically applied to total, discounting the total for each additional month added
    • Will reset the session on validation errors
    • Contains the stripe payment element
  • Route /charge
    • The form action for the payment form, performs the charge and generates the license
    • Validates submitted data
    • If accessed via GET, will redirect to /
    • Redirects back to / on validation failure
    • Redirects to /completed on success
    • Creates stripe customer, charge
    • Creates license and invoice and saves in DB, emails to user
    • Doesn't halt on email send failure, but logs it so the user still gets their license in-browser
  • Route /completed
    • Displays on payment completion and license generation success
    • Will redirect to / if no completion data present (ie. user has navigated directly to /completed)
    • Text from PROCESS.ENV.COMPLETED will appear under optional logo
    • On completion of transaction will display the invoice/license as it was emailed to the user, and a button to download a file copy
    • Resets the session

Installation / Deployment Instructions

Warranty

  • No warranty expressed or implied. I assume no liaibility or responsibility for any damage this software causes. Use at your own risk.

Future

  • Free trial licenses, restricted by email
  • Download link (unique?) on completion, mention on index that the download link and license will be provided post payment
  • Product activation

License

Author

About

This NodeJS/Express Application accepts payment for, and generates a node-js-licensefile compatible software license

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors