Created
September 22, 2017 12:49
-
-
Save AlexeyShepelev/f7ccfcca0b3708c9dbeba420a24dcd26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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