diff --git a/README.html b/README.html deleted file mode 100644 index cf92692..0000000 --- a/README.html +++ /dev/null @@ -1,1065 +0,0 @@ -README

Bank Teller

-

Code Climate

-

Bank Teller is a Ruby on Rails interface for interacting with Stripe. It is an implementation the Laravel library, Cashier. Major props to Taylor Otwell and all of the contributors to Cashier, it’s amazing. Bank Teller has some minor API differences from Cashier, mostly to match the Ruby style. To quote the Cashier project: “It handles almost all of the boilerplate subscription billing code you are dreading writing… coupons, swapping subscription, subscription ‘quantities’, cancellation grace periods, and invoice PDFs.”

-

This gem cannot be used as a stand-alone gem. It is very tightly integrated with ActiveSupport and ActiveRecord. This gem is best used in a Ruby on Rails application.

-

Installation

-

Add this line to your application’s Gemfile:

-
gem 'bank_teller'
-
- -

And then execute:

-
$ bundle
-
-

Bank Teller comes with a couple of migrations:
- 1. A migration to add fields to a users table. users should already exist.
- 2. A migration to create a subscriptions table.

-

To add these migrations to your application, run:

-
$ rails generate bank_teller:install
-$ rake db:migrate
-
-

Usage

-

Setting It Up

-

Stripe requires a private API key. Once you have aquired your private key, you’ll need to set the environment variable ENV["STRIPE_API_KEY"] equal to your API key. If you’re not sure how to use environment variables, checkout Figaro or my favorite, dotenv.

-

Once you have your key in place, all you need to do is include the Billable module in your User class:

-
# app/models/user.rb
-class User < ActiveRecord::Base
-  include Billable
-end
-
- -

Make Some Money

-

Create a Subscription

-
user = User.find(1)
-user.new_subscription('main', 'monthly').create(token)
-
- -

#new_subscription is a method call on a User object that takes two arguments:
- 1. The name of the plan, for internal use
- 2. The ID of the plan you created with Stripe

-

#create takes one argument, the stripe credit card token. It sends the subscription to Stripe and creates the subscription record in the databse.

-

You can also send addtional fields for the user when creating a new subscription.

-
user.new_subscription('main', 'monthly').create(token, { email: 'john@johndoe.com' })
-
- -

To see all the options, checkout the Stripe docs.

-

Development

-

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

-

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

-

Contributing

-

Bug reports and pull requests are welcome on GitHub at https://github.com/jasoncharnes/bank_teller.

\ No newline at end of file diff --git a/README.md b/README.md index cc0a531..4df45d6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Bank Teller is a Ruby on Rails interface for interacting with Stripe. It is an i This gem cannot be used as a stand-alone gem. It is very tightly integrated with ActiveSupport and ActiveRecord. This gem is best used in a Ruby on Rails application. ## Still to Come +### Contribute, if you'd like! - Finish Tests - Add Webhooks - Invoice PDFs