Rails-specific library for working with the Epay.bg API. More information at https://demo.epay.bg/?page=login
Add this line to your application's Gemfile:
gem 'epaybg'
And then execute:
$ bundle
Or install it yourself as:
$ gem install epaybg
Create the config file config/epaybg.yml with the following contents:
production:
secret: YOUR-SECRET-KEY
min: YOUR-MIN
url: "https://epay.bg"
url_idn: "https://epay.bg/ezp/reg_bill.cgi"
test:
secret: YOUR-SECRET-KEY
min: YOUR-MIN
url: "https://demo.epay.bg"
url_idn: "https://demo.epay.bg/ezp/reg_bill.cgi"
Set the mode to production in your config/environments/production.rb file:
# Add to bottom of the file
Epaybg.mode = :production
Handle a response callback from epay:
response = Epaybg::Response.new(params[:encoded], params[:checksum])
response.valid?
# => true
response.status
# => "PAID"
Respond to their callback:
response = Epaybg::Response.new(params[:encoded], params[:checksum])
response.invoice
=> "f5b1eaf"
response.response_for(:ok)
=> "INVOICE=f5b1eaf:STATUS=PAID"
- Fork it
- 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 new Pull Request