OAuth2

Use OAuth2 authentication to access a user's account other than your own. This
library does not handle the handshake process, and assumes you have an access
token when it's initialized. You can handle the handshake process using an
OAuth2 client such as league/oauth2-client.

useCoinbase\Wallet\Client;useCoinbase\Wallet\Configuration;// with a refresh token$configuration=Configuration::oauth($accessToken, $refreshToken);// without a refresh token$configuration=Configuration::oauth($accessToken);$client=Client::create($configuration);

Two factor authentication

The send money endpoint requires a 2FA token in certain situations (read more
here). A specific exception is thrown when this is required.

Resource references can be used when creating new resources, avoiding the
overhead of requesting a resource from the API.

useCoinbase\Wallet\Resource\Deposit;useCoinbase\Wallet\Resource\PaymentMethod;$deposit=newDeposit(['paymentMethod'=>PaymentMethod::reference($paymentMethodId)]);// or use the convenience method$deposit=newDeposit(['paymentMethodId'=>$paymentMethodId]);

Responses

There are multiple ways to access raw response data. First, each resource
object has a getRawData() method which you can use to access any field that
are not mapped to the object properties.

$data=$deposit->getRawData();

Raw data from the last HTTP response is also available on the client object.

$data=$client->decodeLastResponse();

Active record methods

The library includes support for active record methods on resource objects. You
must enable this functionality when bootstrapping your application.

Contributing and testing

The test suite is built using PHPUnit. Run the suite of unit tests by running
the phpunit command.

phpunit

There is also a collection of integration tests that issues real requests to the
API and inspects the resulting objects. To run these tests, you must copy
phpunit.xml.dist to phpunit.xml, provide values for the CB_API_KEY and
CB_API_SECRET variables, and specify the integration group when running the
test suite.