Coinbase Commerce SDK is a PHP library for interacting with the Coinbase Commerce API.
You can install the package via composer:
composer require localtools/coinbase-commerce-sdk
use LocalTools\CoinbaseCommerceSdk\CoinbaseCommerce;
$token = 'your-access-token';
$sdk = new CoinbaseCommerce($token);
$checkouts = $sdk->checkouts->listCheckouts();
echo json_encode($checkouts, JSON_PRETTY_PRINT);
use LocalTools\CoinbaseCommerceSdk\Dtos\CreateChargeDto;
use LocalTools\CoinbaseCommerceSdk\Responses\Checkout\Extra\LocalPrice;
$createChargeDto = new CreateChargeDto(
'The Human Fund',
'Money For People',
'fixed_price',
new LocalPrice('1.00', 'USD'),
'USD'
);
$charge = $sdk->charges->createCharge($createChargeDto);
echo $charge->id;
$charge = $sdk->charges->retrieveCharge('charge_id');
echo json_encode($charge, JSON_PRETTY_PRINT);
$events = $sdk->events->retrieveAllEvents();
echo json_encode($events, JSON_PRETTY_PRINT);
$event = $sdk->events->retrieveEvent('event_id');
echo json_encode($event, JSON_PRETTY_PRINT);
composer test
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.