I'm creating a web app that uses Bitpay for payments. I'm writing it in ruby (but that shouldn't matter), and have a class method bitpay_client with the body BitPay::Client.new('mYs3cretAPIkey').

Anytime I do BitcoinInvoice.bitpay_client.get("invoice/#{invoice_id}") I get the JSON {"error": "Invalid token"} back from the server. In Bitpay's documentation there's no mention of this message. I'm using the right api key, and I'm sure this is a real invoice. What does this message mean?


The error was my client connected to the wrong endpoint. This feature was undocumented at the time, but is now clearly documented. Kudos to Bitpay!

  • This isn't quite fair. First, Bitpay support was available to you for help. Second, the old API did still work if you used the right endpoint, and that was not something hardcoded into the library. Third, both the version 1 and 2 libraries are available on RubyGems. rubygems.org/gems/bitpay-client
    – philosodad
    Oct 19 '14 at 20:07
  • You're right, that was unfair. I beg your apologies and made an updated answer. Thanks for providing a great service! Oct 20 '14 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.