Ruby wrapper for Fondy API: https://portal.fondy.eu/en/info/api/v1.0
Add this line to your application's Gemfile:
gem 'fondy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fondy
First, create API client:
client = Fondy::Client.new(merchant_id: 1, password: 'qwerty')
Check payment status:
response = client.status(order_id: 2)
response.success?
# => true
response.order_status
# => "approved"
response.to_h
# => {
# response_status: "success",
# order_status: "approved",
# actual_amount: 100,
# ...
# }
response.error?
# => true
response.error_code
# => 1018
response.error_message
# => "Order not found"
response.to_h
# => {
# response_status: "failure",
# error_message: "Order not found",
# error_code: 1018
# }
Create payment:
response = client.checkout(order_id: 2, order_desc: '...', amount: 100, currency: 'USD')
response.checkout_url
# => "https://api.fondy.eu/api/checkout?token=..."
Capture payment:
response = client.capture(order_id: 2, amount: 100, currency: 'USD')
Refund payment:
response = client.reverse(order_id: 2, amount: 100, currency: 'USD')
response = client.reverse(order_id: 2, amount: 100, currency: 'USD', comment: '...')
Bug reports and pull requests are welcome on GitHub at https://github.com/busfor/fondy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.