Razorpay Ruby bindings
This is the base ruby gem for interacting with the Razorpay API. This is primarily meant for users who wish to perform interactions with the Razorpay API programatically.
Installation
Add this line to your application's Gemfile:
gem 'razorpay'
And then execute:
$ bundle
Or install it yourself as:
$ gem install razorpay
Requirements
Ruby 2.6.8 or later
Usage
Remember to require 'razorpay'
before anything else.
Next, you need to setup your auth details. This setup can be done via two ways:
Using Private Auth
you need to setup your key and secret using the following:
Razorpay.setup('key_id', 'key_secret')
You can set customer headers for your requests using the following:
Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
Using Access Token
you need to setup your access token using the following
Razorpay.setup_with_oauth('access_token')
You can set customer headers for your requests using the following:
Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}
You can find your API keys at https://dashboard.razorpay.com/#/app/keys.
If you are using rails, the right place to do this might be config/initializers/razorpay.rb
.
Supported Resources
- Account
- Customer
- Token
- Order
- Payments
- Settlements
- Fund
- Refunds
- Invoice
- Plan
- Item
- Subscriptions
- Add-on
- Payment Links
- Product Configuration
- Smart Collect
- Stakeholder
- Transfer
- QR Code
- Emandate
- Cards
- Paper NACH
- UPI
- Register Emandate and Charge First Payment Together
- Register NACH and Charge First Payment Together
- Payment Verification
- Webhook
- OAuthToken
- Dispute
- Document
Development
- Everything is namespaced under the Razorpay module
- We use rubocop for checking style guidelines
- Rake + MiniTest is using as the testrunner
- Webmock is used as the request mock framework
- HTTParty is used for making requests
- Travis is used for CI
- Coveralls is used for coverage reports
Contributing
- Fork it ( https://github.com/razorpay/razorpay-ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Run
rake
andrubocop
after making your changes to make sure you didn't break anything - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Release
Steps to follow for a release:
- Merge the branch with the new code to master.
- Bump the Version in
lib/razorpay/constants.rb
- Rename Unreleased to the new tag in
CHANGELOG
- Fix links at bottom in
CHANGELOG
- Commit (message should include version number)
- Tag the release and push to GitHub. Get the tag signed using Razorpay GPG key.
- Create a release on GitHub using the website with more details about the release
- Run
gem build razorpay-ruby.gemspec
- Run
gem push razorpay-{version}.gem
gem push
will ask you for credentials, if you are not logged in already.