What does Bitpay's {"error": "Invalid token"} mean?

0

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?

Martin Josefsson

Posted 2014-09-18T14:42:32.527

Reputation: 233

Answers

1

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!

Martin Josefsson

Posted 2014-09-18T14:42:32.527

Reputation: 233

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. https://rubygems.org/gems/bitpay-client/

– philosodad – 2014-10-19T20:07:53.930

You're right, that was unfair. I beg your apologies and made an updated answer. Thanks for providing a great service! – Martin Josefsson – 2014-10-20T15:57:49.740