Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/localtools/coinbase-commerce-sdk
Coinbase Commerce SDK
https://github.com/localtools/coinbase-commerce-sdk
api bitcoin coinbase commerce ethereum php usd-coin
Last synced: 3 days ago
JSON representation
Coinbase Commerce SDK
- Host: GitHub
- URL: https://github.com/localtools/coinbase-commerce-sdk
- Owner: localtools
- License: mit
- Created: 2024-11-15T21:02:46.000Z (4 days ago)
- Default Branch: main
- Last Pushed: 2024-11-15T21:08:09.000Z (4 days ago)
- Last Synced: 2024-11-15T22:09:52.828Z (4 days ago)
- Topics: api, bitcoin, coinbase, commerce, ethereum, php, usd-coin
- Language: PHP
- Homepage: https://docs.cdp.coinbase.com/commerce-onchain/docs/welcome
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Coinbase Commerce SDK
[![Latest Version on Packagist](https://img.shields.io/packagist/v/localtools/coinbase-commerce-sdk.svg?style=flat-square)](https://packagist.org/packages/localtools/coinbase-commerce-sdk)
[![Total Downloads](https://img.shields.io/packagist/dt/localtools/coinbase-commerce-sdk.svg?style=flat-square)](https://packagist.org/packages/localtools/coinbase-commerce-sdk)
[![License](https://img.shields.io/packagist/l/localtools/coinbase-commerce-sdk.svg?style=flat-square)](https://packagist.org/packages/localtools/coinbase-commerce-sdk)Coinbase Commerce SDK is a PHP library for interacting with the Coinbase Commerce API.
## Installation
You can install the package via composer:
```bash
composer require localtools/coinbase-commerce-sdk
```## Usage
### Initialization
```php
use LocalTools\CoinbaseCommerceSdk\CoinbaseCommerce;$token = 'your-access-token';
$sdk = new CoinbaseCommerce($token);
```### Checkouts
#### List Checkouts
```php
$checkouts = $sdk->checkouts->listCheckouts();
echo json_encode($checkouts, JSON_PRETTY_PRINT);
```### Charges
#### Create Charge
```php
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;
```#### Retrieve Charge
```php
$charge = $sdk->charges->retrieveCharge('charge_id');
echo json_encode($charge, JSON_PRETTY_PRINT);
```### Events
#### Retrieve All Events
```php
$events = $sdk->events->retrieveAllEvents();
echo json_encode($events, JSON_PRETTY_PRINT);
```#### Retrieve Event
```php
$event = $sdk->events->retrieveEvent('event_id');
echo json_encode($event, JSON_PRETTY_PRINT);
```## Testing
```bash
composer test
```## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Hebert Barros](https://github.com/hebertcisco)
- [All Contributors](https://github.com/localtools/coinbase-commerce-sdk/graphs/contributors)## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.