Wrapper API for Moolah's Transaction API (v2)
Add this line to your application's Gemfile:
gem 'moolah-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install moolah-ruby
Configuration:
require 'moolah'
Moolah.configure do |config|
config.api_key = ENV['API_KEY']
config.api_secret = ENV['API_SECRET'] # necessary for IPN response
# config.endpoint = "https://api.moolah.io" # endpoint must not contain paths, "/v2" is included in API calls
end
Create a transaction:
moolah_client = Moolah::Client.new
# No IPN Response
response = moolah_client.create_transaction(coin: "bitcoin", currency: "USD", amount: "20", product: "Coingecko Pro")
# IPN Response
response = moolah_client.create_transaction(coin: "bitcoin", currency: "USD", amount: "20", product: "Coingecko Pro", ipn: "www.example.com/processed_payment", ipn_extra: "{ user_id: 1 }")
response[:status] # "success"
response[:guid] # "1234-1234-1234-1234"
response[:address] # "abcdefghijklmnopqrstuvwxyz"
# etc.
Query a transaction:
query_result = moolah_client.query_transaction(guid:"1234-1234-1234-1234")
query_result[:status] # "success"
query_result[:transaction][:tx][:coin] # "bitcoin"
# etc.
Complete API documentation available at https://moolah.io/dashboard/merchant/api
- Fork it ( https://github.com/coingecko/moolah-ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request