substripe

Extremely simple subscription payment form with Stripe in seconds.

Substripe

Extremely simple subscription payment form with Stripe in seconds.

Great for charging {{someone}} for a monthly subscription to {{something}}.

Try out the demo at http://substripe.com:3000/plan/demo (enter credit card 4242-4242-4242-4242 with any valid exp date and any CVC).

View this documentation at http://documentup.com/niftylettuce/substripe.

npm install -g substripe
  • Spin up a server in either development or production mode (see below).

Here are the following environment variables and their default values.

Environment VariableDefault ValueDescription
SKNone (required)Stripe secret key
PKNone (required)Stripe public key
PUBLIC./Path to public directory for serving assets (e.g. Stripe Checkout image, see below Tricks)
PORT3000Port to run substripe server on
NODE_ENVdevelopment (if value is "production", then PORT is set to 443)Node.js environment (either "development" or "production")
KEYNone (required in production)Path to SSL key
CERTNone (required in production)Path to SSL cert
CANone (required in production)Path to SSL CA cert
PUBLIC=./ PORT=3000 SK=stripe-test-sk PK=stripe-test-pk

http://localhost:3000/plan/{{stripe_plan_id}}

Register a domain name and an SSL certificate (e.g. PositiveSSL or RapidSSL) at Namecheap (affiliate link, you can use coupon "DOMAINZZ" as of Feb 7, 2014 to save some bones).

Port is automatically set to 443 (https protocol) in production mode (as required by Stripe), so you don't need to pass PORT environment variable like in development mode (see above).

You need to pass a valid path to the SSL certificate's key, cert, and CA files as well.

NODE_ENV=production KEY=./key.pem CERT=./cert.pem CA=./ca.pem PUBLIC=./ SK=stripe-live-sk PK=stripe-live-pk substripe

https://yourdomain.com/plan/{{stripe_plan_id}}

You can add the following options as querystring parameters to pre-populate the Stripe checkout form. These options are the same the Configuration Options from Stripe.

(e.g. pre-populate an image and an email address of the customer https://yourdomain.com/{{stripe_plan_id}}?image=%2Fsubstripe.png&email=niftylettuce@gmail.com)

ParamDefault Value
image"/substripe.png"
namedisplay name
description"Subscribe to {{plan.name}}"
amount{{plan.amount}} (cents)
currency"usd"
panel_label"Subscribe @ ${{plan.amount}}/{{plan.interval}}"
billing_addressfalse
shipping_addressfalse
email""
label"Subscribe @ ${{plan.amount}}/{{plan.interval}}"

NOTE: Default value's for panel_label and label have the values of {{plan.interval}} abbreviated (e.g. "week" => "wk", "month" => "mo", "year" => "yr").

The MIT License

Copyright (c) 2014- Nick Baugh niftylettuce@gmail.com (http://niftylettuce.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.