Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
h1. StripeRails
Stripe Rails was built on top of the official stripe gem to bring ease of use of stripe in your models. The gem also caches the stripe customer response so that if you often use it to check a customers subscription status, it wont have to reach the stripe API on every page load. Lastly, this gem has built in responses for stripe webhooks/callbacks.
h3. Installation
Add the following to your gemfile and run bundle install.
gem 'stripe_rails'
h3. Compatibility
The gem works with rails 3.2.x and mongoid and active:record when using model relationships. It uses rails cache to cache the stripe object for 1 hour on subsequent get requests.
h2. Usage
h3. Models
Stripe Rails is easily used in your model and some configuration can be added to provide some additional functionality.
class MyModel include Mongoid::Document include StripeRails::ActsLikeCustomer ... end
class MyModel include Mongoid::Document include StripeRails::ActsLikeCustomer stripe_description :title # allows you to provide a method to tell stripe a description for the customer. stripe_subscription_plan :monthly_subscription # will automatically add the customer to the subscription. stripe_unit_price 45 # allows the usage of a per unit price which can be used later in callbacks. stripe_units :users # specifies the units to be counted for per unit pricing. ... end
h3. Callbacks
Stripe rails provides a generator that will create a callback in your main application. Use:
rails g stripe_callback charge.succeeded
**Note: A list of callbacks can be found in stripes API documentation.
This will generate a file like this:
class ChargeSucceededCallback < StripeRails::Callback # Some logic to process during the callback def actions # The response hash @response = {success: true} end end
if you choose to send a response it must be set in the actions method with the instance variable of response. It will expect a hash that will be later be converted into JSON to give back to stripe.
h4. Unused callbacks
Unused callbacks will respond with the proper 501 (Not Implemented) response.
h2. How to contribute
bundle exec rake
)h2. Project Info
StripeRails was created by "Jason Waldrip":http://www.jasonwaldrip.com/
The project is hosted on Github: "http://github.com/jwaldrip/stripe_rails":http://github.com/jwaldrip/stripe_rails, where your contributions, forkings, comments, issues and feedback are greatly welcomed.
Copyright (c) 2012 Jason Waldrip, released under the MIT license.
h4. More to documentation to come in the next versions!
FAQs
Unknown package
We found that stripe_rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.