Solidus Stripe

CircleCI

Stripe Payment Method for Solidus. It works as a wrapper for the ActiveMerchant Stripe gateway.


Installation

In your Gemfile:

gem "solidus_stripe", github: "solidusio/solidus_stripe"

Then run from the command line:

bundle install
bundle exec rails g solidus_stripe:install
bundle exec rails db:migrate

Usage

Navigate to Settings > Payments > Payment Methods in the admin panel. You can now create a new payment method that uses Stripe by selecting Stripe credit card under Type in the New Payment Method form and saving. The Stripe payment method's extra fields will be now shown in the form.

Configure via database configuration

If you want to store your Stripe credentials in the database just fill the new fields in the form, selecting custom (default) in the Preference Source field.

Configure via static configuration

If you want to store your credentials into your codebase or use ENV variables you can create the following static configuration:

# config/initializers/spree.rb

Spree.config do |config|
  # ...

  config.static_model_preferences.add(
    Spree::PaymentMethod::StripeCreditCard,
    'stripe_env_credentials',
    secret_key: ENV['STRIPE_SECRET_KEY'],
    publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
    v3_elements: false,
    server: Rails.env.production? ? 'production' : 'test',
    test_mode: !Rails.env.production?
  )
end

Once your server has been restarted, you can select in the Preference Source field a new entry called stripe_env_credentials. After saving, your application will start using the static configuration to process Stripe payments.

Migrating from solidus_gateway

If you were previously using solidus_gateway gem you might want to check out our Wiki page that describes how to handle this migration.

Testing

Then just run the following to automatically build a dummy app if necessary and run the tests:

bundle exec rake

Releasing

We use gem-release to release this extension with ease.

Supposing you are on the master branch and you are working on a fork of this extension, upstream is the main remote and you have write access to it, you can simply run:

gem bump --version minor --tag --release --remote upstream

This command will:

  • bump the gem version to the next minor (changing the version.rb file)
  • commit the change and push it to upstream master
  • create a git tag
  • push the tag to the upstream remote
  • release the new version on RubyGems

Or you can run these commands individually:

gem bump --version minor --remote upstream
gem tag --remote upstream
gem release