Coinbase-php createButton throws 401 error

0 votes

I'm using coinbase-php to generate payment pages and process orders on my website. I'm able to create buttons and payment pages without any problems, but when I attempt to check an order's status, I get a 401 error. The code I'm using is:

$coinbase = Coinbase::withApiKey($coinbase_key, $coinbase_secret);
$data = json_decode($coinbase->get('/orders/'.$order_id));

And this is the error I get:

Notice: exception 'Coinbase_ApiException' with message 'Status code 401' in lib\Coinbase\Requestor.php:22  
Stack trace:  
#0 lib\Coinbase\Rpc.php(95): Coinbase_Requestor->doCurlRequest(Resource id #50)  
#1 lib\Coinbase\Coinbase.php(64): Coinbase_Rpc->request('GET', '/orders/6c00ec5...', Array)  
#2 inc\admin\orders.inc.php(214): Coinbase->get('/orders/N1263OA...')  
Aug 30, 2018 in Blockchain by slayer
• 29,370 points
1,058 views

2 answers to this question.

0 votes

try this:

$coinbase = Coinbase::withApiKey($coinbase_key, $coinbase_secret);
$status = $coinbase->getOrder($order_id)->status;
answered Aug 30, 2018 by digger
• 26,740 points
0 votes

I found the explanation for this on StackOverFlow. 

I see that you have answered your own question, but let me extend on why you got the 401 error.

As @r3wt mentioned, 401 means unauthorized error. Coinbase recently introduced a new feature that can allow you to manage permissions for any api key pair. You can see the permissions here: http://i.imgur.com/ZKoGpz2.png

Your issue may have been caused by incorrect permissions. Coinbase also did have an outage and also updated their API and UI. You might have made your api call then and it might have failed. I hope this explained any questions you might have had.

answered Aug 30, 2018 by Naman

Related Questions In Blockchain

0 votes
1 answer

Coinbase spot price SSL Error: does not support SSL at Request

Add 'strictSSL': false to the new client: var btcClient = ...READ MORE

answered Sep 6, 2018 in Blockchain by digger
• 26,740 points
774 views
0 votes
1 answer

jsonRPCClient Error with php variables

All you have to do is change ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
792 views
0 votes
2 answers

how to integrate coinbase api in php for transfer bitcoine

Here the code for php please have ...READ MORE

answered Sep 17, 2018 in Blockchain by Suresh
3,135 views
0 votes
1 answer

Hyperldger: Hyperledger Explorer not starting. Throws error

in "network-config" you should use lowercase 'org1' { ...READ MORE

answered Nov 8, 2018 in Blockchain by Omkar
• 69,220 points
2,284 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,216 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
884 views
0 votes
1 answer

Send Payment error in Blockchain API

The following code should help: $address = null; try ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
1,752 views
0 votes
1 answer

403 forbidden error coinbase api

I had a similiar issue connecting this API, ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
2,637 views
0 votes
1 answer

Coinbase currency_exchange error

This is the fix: $(document).ready(function () { ...READ MORE

answered Aug 30, 2018 in Blockchain by digger
• 26,740 points
1,035 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP