Search code examples
phpbitcoincoinbase-api

How to integrate sandbox in coinbase/coinbase php library..?


I have setup coinbase/coinbase library, and it will setup successfully and working, but when I start work with sandbox it'll give me error.

Suppose I have added my apikey,api-secretekey and sandbox url like below :

   $configuration = Configuration::apiKey($apiKey,$apiSecret);
   $configuration->setApiUrl(Configuration::SANDBOX_API_URL);
   $client = Client::create($configuration);

It return exception error like below :

Uncaught exception 'GuzzleHttp\Exception\ServerException' with message ' in D:\wamp\www\open_digy-pay\trunk\vendor\coinbase\coinbase\src\Exception\HttpException.php on line 37

When I remove sandbox url line from code it'll work fine but without sandbox How could I test.

Any one having idea why it'll give me error like below?

enter image description here


Solution

  • Yes you have API Keys Error
    1: Login to Coinbase Sandbox account
    2: Setting -> API Access
    3: Create +New API Key for Sandbox Account

    Now Try with sandbox keys

    $apiKey = "***************";
    $apiSecret = "*******************************";
    $configuration = Configuration::apiKey($apiKey, $apiSecret);
    $configuration->setApiUrl(Configuration::SANDBOX_API_URL);
    $client = Client::create($configuration);
    

    It's work for me Thanks