[BREAKGLASS] Append-only mirror of github.com/btcpayserver/ruby-client
Go to file
Nathan Marley 95bf92a818 remove hard-coded version string from req header
Use the gem version constant instead of the string existing in
multiple places. This will prevent confusion in case the client
version is bumped but the request header gets missed. This could lead
to potential confusion if Bitpay ever needs to debug version of Ruby
client used to access the API.
2014-05-18 12:19:41 -07:00
lib remove hard-coded version string from req header 2014-05-18 12:19:41 -07:00
test Force JSON for post body 2014-01-02 15:34:18 -08:00
.gitignore initial commit 2013-11-01 11:51:01 -07:00
.travis.yml Update Travis for Ruby 2x, pull jruby 2014-03-19 01:40:48 -07:00
bitpay-client.gemspec initial commit 2013-11-01 11:51:01 -07:00
Gemfile initial commit 2013-11-01 11:51:01 -07:00
LICENSE.md initial commit 2013-11-01 11:51:01 -07:00
Rakefile initial commit 2013-11-01 11:51:01 -07:00
README.md Update README.md 2014-04-14 16:31:58 -04:00

BitPay Library for Ruby

Powerful, flexible, lightweight interface to the BitPay Bitcoin Payment Gateway API.

Installation

gem install bitpay-client

In your Gemfile:

gem 'bitpay-client', :require => 'bitpay'

Or directly:

require 'bitpay'

Basic Usage

To create an invoice:

client = BitPay::Client.new 'YOUR_API_KEY'
invoice = client.post 'invoice', {:price => 10.00, :currency => 'USD'}

With invoice creation, price and currency are the only required fields. If you are sending a customer from your website to make a purchase, setting redirectURL will redirect the customer to your website when the invoice is paid.

Response will be a hash with information on your newly created invoice. Send your customer to the url to complete payment:

{
  "id"             => "DGrAEmbsXe9bavBPMJ8kuk", 
  "url"            => "https://bitpay.com/invoice?id=DGrAEmbsXe9bavBPMJ8kuk",
  "status"         => "new",
  "btcPrice"       => "0.0495",
  "price"          => 10,
  "currency"       => "USD",
  "invoiceTime"    => 1383265343674,
  "expirationTime" => 1383266243674,
  "currentTime"    => 1383265957613
}

There are many options available when creating invoices, which are listed in the BitPay API documentation.

To get updated information on this invoice, make a get call with the id returned:

invoice = client.get 'invoice/DGrAEmbsXe9bavBPMJ8kuk'

API Documentation

API Documentation is available on the BitPay site.

RDoc/YARD Documentation

The code has been fully code documented, and the latest version is always available at the Rubydoc Site.

Running the Tests

$ bundle install
$ bundle exec rake

In addition to a full test suite, there is Travis integration for MRI 1.9, JRuby and Rubinius.

Found a bug?

Let us know! Send a pull request or a patch. Questions? Ask! We're here to help. We will respond to all filed issues.

Authors

  • Kyle Drake