Skip to content

Instantly share code, notes, and snippets.

@kubicek
Last active July 4, 2016 12:32
Show Gist options
  • Select an option

  • Save kubicek/258466ffe239208d8e5422497891fc2e to your computer and use it in GitHub Desktop.

Select an option

Save kubicek/258466ffe239208d8e5422497891fc2e to your computer and use it in GitHub Desktop.
bitcoinpay transaction history import
require 'rest-client'
require 'json'
data = RestClient::Request.execute(
method: :get,
url: 'https://www.bitcoinpay.com/api/v1/transaction-history/',
headers: {Authorization: 'Token nastoken'}
)
transactions = JSON.parse(data)['data']
transactions.select{|t|
t['status']=="confirmed" && t['currency']=="CZK" && t['confirmations'].to_i > 3
}.each{|t|
puts t["payment_id"] # STRING!!
puts t["price"] #string
puts t["reference"] #string
}
@kubicek
Copy link
Copy Markdown
Author

kubicek commented Jul 4, 2016

6WksSFBVdZP7sL53
2000.00
9903585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment