
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
KoducStripe is a lightweight wrapper for Stripe payments API. This ruby gem provides a platform to integrate Stripe payment gateway in Ruby on Rails Application.
Currently KoducStripe supports One-time Payment with partially or completely Refund payment with Stripe.
It is developed for the usage in Ruby on Rails web applications and integrates as a Rails plugin.
It is developed in November 2015 by KSolves team with the help of valuable contributors.
Add this line to your application's Gemfile:
gem 'koduc_stripe'
And then execute:
$ bundle
Or install it yourself as:
$ gem install koduc_stripe
Provide the Stripe API Key while initializing the Rails Application by placing the key under config/initializer
.
Create a new file in initializer, say koduc_stripe.rb
and write below piece of code there.
KsStripe::Client.configure do |config|
config.stripe_api_key = STRIPE_API_KEY
end
** Do not forget to restart the rails server after adding Stripe API Key.
To charge a user, first create an object of KsStripe::KsBase
class by supplying a hash containing card details. Hash should have below keys:
card_number => Card Number to charged (Required)
cvc => Card Verification Code of the card (Required)
exp_month => Expiration month of the Card (Required)
exp_year => Expiration Year of the Card (Required)
name => Name on the Card (Optional)
card_type => Type of the credit card (Optional)
For example:
card_obj = KsStripe::KsBase.new(
:card_number=>'4242424242424242',
:cvc=>'123',
:exp_month => '01',
:exp_year => '2020',
:card_type => 'visa',
:name=>"Atul Khanduri"
)
Secondly, charge the user by calling charge method
from KsStripe::KsBase
object with amount to be charged and optional description of the payment as parameters.
For example:
charge = card_obj.charge(10, "This is a test payment by KsStripe Gem")
If the Charge is successful then the response will be the response returned by Stripe.
If there's any validation or any other error in the payment, then all the errors are returned in below format:
{
"error" => {
"message" => [<All the Error Messages in Array>]
}
}
To refund a one-time payment, call KsStripe::KsBase.refund
method with parameters as charge id, optional amount(in cents) to be refund and optional reason of the refund.
KsStripe::KsBase.refund(<charge_id>, <amount>, <reason>)
If the refund is successful then the response will be the response returned by Stripe.
If there's any validation or any other error in payment refund, then all the errors are returned in below format:
{
"error" => {
"message" => [<All the Error Messages in Array>]
}
}
If you found any issue in the Gem then do not forgot to create a issue in Github.
If you have any query, need support or advice just DROP us a line and we’ll be in touch very soon.
Email: support@koduc.com
You can also contact us at +91-120-4540178
We’d love to hear from you! :) :)
FAQs
Unknown package
We found that koduc_stripe 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.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.