Download the PHP package neto737/coinbase-commerce without Composer
On this page you can find all versions of the php package neto737/coinbase-commerce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neto737/coinbase-commerce
More information about neto737/coinbase-commerce
Files in neto737/coinbase-commerce
Package coinbase-commerce
Short Description Coinbase Commerce API library
License Apache-2.0
Homepage https://commerce.coinbase.com/
Informations about the package coinbase-commerce
Coinbase Commerce
Fork of the official PHP library for the Coinbase Commerce API.
Note: The official repository is not actively maintained.
If the official repository gets updated, this fork will be deleted or updated accordingly. You'll notice when updating packages using composer
results in an error. In this case, the official repository has probably been updated and this fork has been removed.
Table of contents
- PHP Versions
- Documentation
- Installation
- Usage
- Checkouts
- Charges
- Invoices
- Events
- Webhooks
- Warnings
- Testing and Contributing
PHP versions
PHP version 7.4 and above are supported.
Documentation
For more details visit Coinbase API docs.
To start using this library register an account on Coinbase Commerce.
You will find your API_KEY
from User Settings.
Next initialize a Client
for interacting with the API. The only required parameter to initialize a client is apiKey
, however, you can also pass in baseUrl
, apiVersion
and timeout
.
Parameters can be also be set post-initialization:
Disable SSL Check
The API resource class provides the following static methods: list, all, create, retrieve, updateById, deleteById
. Additionally, the API resource class also provides the following instance methods: save, delete, insert, update
.
Each API method returns an ApiResource
which represents the JSON response from the API.
When the response data is parsed into objects, the appropriate ApiResource
subclass will automatically be used.
Client supports the handling of common API errors and warnings. All errors that occur during any interaction with the API will be raised as exceptions.
Error | Status Code |
---|---|
APIException | * |
InvalidRequestException | 400 |
ParamRequiredException | 400 |
ValidationException | 400 |
AuthenticationException | 401 |
ResourceNotFoundException | 404 |
RateLimitExceededException | 429 |
InternalServerException | 500 |
ServiceUnavailableException | 503 |
Installation
If you already have a composer.json
file in your project, you can skip Step 3 by pre-editing the composer.json
file (Step 2) and then finish with Step 1.
Step 1: Install the official package with composer
Step 2: Add this fork to the version control system (VCS)
The composer.json
file should require the package like this:
Edit composer.json
to require the package like this instead:
Step 3: Update the source files with composer
Usage
Checkouts
Checkouts API docs
More examples on how to use checkouts can be found in the examples/Resources/CheckoutExample.php
file
Load checkout resource class
Retrieve
Create
Update
Delete
List
List method returns ApiResourceList object.
Get all checkouts
Charges
Charges API docs
More examples on how to use charges can be found in the examples/Resources/ChargeExample.php
file
Load charge resource class
Retrieve
Create
List
Get all charges
Resolve a charge
Resolve a charge that has been previously marked as unresolved.
Cancel a charge
Cancels a charge that has been previously created. Note: Only new charges can be successfully canceled. Once payment is detected, charge can no longer be canceled.
Invoices
Invoices API docs
More examples on how to use charges can be found in the examples/Resources/InvoiceExample.php
file
Load invoice resource class
Retrieve
Create
List
Get all invoices
Resolve an invoice
Resolve an invoice that has been previously marked as unresolved.
Note: Only invoices with an unresolved charge can be successfully resolved.
Void an invoice
Voids an invoice that has been previously created.
Note: Only invoices with OPEN
or VIEWED
status can be voided. Once a payment is detected, the invoice can no longer be voided.
Events
Events API Docs
More examples on how to use events can be found in the examples/Resources/EventExample.php
file
Load event resource class
Retrieve
List
Get all events
Warnings
It's prudent to be conscious of warnings. The library will log all warnings to a standard PSR-3 logger if one is configured.
Webhooks
Coinbase Commerce signs the webhook events it sends to your endpoint, allowing you to validate and verify that they weren't sent by someone else.
You can find a simple example of how to use this with Express in the examples/Webhook
folder
Verify Signature header
Testing and Contributing
Any and all contributions are welcome! The process is simple: fork this repo, make your changes, run the test suite, and submit a pull request. To run the tests, clone the repository and run the following commands:
License
Apache-2.0