bepaid

bepaid.by payment Ruby API


Keywords
bepaid, ecommerce, meteor, payment
Install
gem install bepaid -v 0.1.0

Documentation

Bepaid

Configuration

Bepaid::Config.shop_id = ENV.fetch('SHOP_ID')
Bepaid::Config.secret_key = ENV.fetch('SECRET_KEY')
Bepaid::Config.public_key = ENV.fetch('PUBLIC_KEY')
Bepaid::Config.test = true
Bepaid::Config.logger = Logger.new(STDOUT)

You may override configuration params localy:

Bepaid::Cli.new(shop_id: 3)

Create Payment

Bepaid::Cli.new.checkout.post do |req|
  req.order do |order|
    order.amount = 100_00
    order.currency = 'BYN'
    order.description = 'Test order'
  end

  req.settings do |settings|
    settings.success_url = 'http://example.com/null'
    settings.decline_url = 'http://example.com/null'
    settings.fail_url = 'http://example.com/null'
    settings.cancel_url = 'http://example.com/null'
  end
end

Will response with:

{"checkout":
  {
    "token": "87ef0c3915c2", 
    "redirect_url": "https://checkout.bepaid.by/v2/checkout?token=87ef0c3915c2d8"
  }
}