Skip to content

Instantly share code, notes, and snippets.

@AlexeyShepelev
Created September 22, 2017 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexeyShepelev/f7ccfcca0b3708c9dbeba420a24dcd26 to your computer and use it in GitHub Desktop.
Save AlexeyShepelev/f7ccfcca0b3708c9dbeba420a24dcd26 to your computer and use it in GitHub Desktop.
require "net/http"
# You can get the api_gateway_id value from your gateway's info
# in the dashboard panel.
gateway_id = 17171
# It determines the amount to be paid for this order.
amount_in_btc = 2.5
# When a callback request is issued, this callback_data param will
# be returned back.
callback_data = "Order number 47"
# It generates payment request URL
url = "https://api.gear.mycelium.com/gateways/#{gateway_id}/orders"
url << "?amount=#{amount_in_btc}"
url << "&callback_data=#{callback_data}"
uri = URI(url)
# Does payment request to Mycelium Gear developer API
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
req = Net::HTTP::Post.new(uri)
http.request(req)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment