dev-master
9999999-dev https://www.wpdownloadmanager.com/download/coinbase-payment-gateway/PHP SDK for Coinbase commerce
GPL-3.0-or-later
The Requires
- php ^5.6 || ^7.0
- guzzlehttp/guzzle 6.*
php rest sdk crypto coinbase commerce api v1
Wallogit.com
2017 © Pedro Peláez
PHP SDK for Coinbase commerce
This SDK is a way to simplify the usage of Coinbase Commerce REST API for your web application., (*1)
Coinbase Commerce is the easiest and safest way for your business to start accepting digital currency payments. For more info go to Coinbase Commerce API reference page, (*2)
The following are the endpoints available, (*3)
POST /api/charge GET /api/charge
POST /api/checkout GET /api/checkout
The coinbase-commerce-php-sdk is available at GitHub. It requires PHP Guzzle and PHP 5.6 or later., (*4)
You will need to use Composer to install dependencies. Assuming you already have Composer:, (*5)
$ composer require codename065/coinbase-commerce-php-sdk
To use the Coinbase Commerce PHP SDK from Composer:
* Add a composer.json file to your project and link to Coinbase Commerce:, (*6)
{
"require": {
"codename065/coinabse-commerce": "*"
}
}
Run composer install or composer update to download the latest version and dependencies., (*7)
First, clone the repository:, (*8)
# git clone https://github.com/codename065/coinbase-commerce.git # optionally, specify the directory in which to clone $ cd path/to/install
Then, you can run the composer command to install:, (*9)
$ composer install
The SDK has a very simple architecture:, (*10)
HTTP Client to communicate with Coinbase Commerce servers Models Data Objects, to hold and transport data
Below you can find an example for the Charge endpoint ( \charge ), (*11)
<?php
// Include Composer autoload
require_once ('vendor/autoload.php');
// Create a client
$client = new \WPDMPP\Coinbase\Commerce\Client();
$client->setApiKey('{your API Key}')
// Prepare the charge
$charge = new \WPDMPP\Coinbase\Commerce\Model\Charge();
// Create local price
$money = new \WPDMPP\Coinbase\Commerce\Model\Money();
$money->SetAmount('5.00');
$money->SetCurrency('USD');
$charge->setName('$5 Talk Credits');
$charge->setDescription('Talk to Anyone, Anytime!');
$charge->setPricingType('fixed_price');
$charge->setLocalPrice($money);
$charge->setRedirectUrl('{https://your.site.com}');
try{
// Create the request and get back Coinbase Commerce response
$response = $client->createCharge($charge);
}catch(\Exception $ex){
echo $ex->getMessage();
}
// Print response
echo ($response);
, (*12)
Any questions regarding the Coinbase Commerce PHP SDK , don't hesitate to contact us at support@wpdownloadmanager.com, (*13)
Coinbase payment gateway for WordPress Download Manager, (*14)
https://www.wpdownloadmanager.com/download/coinbase-payment-gateway/, (*15)
PHP SDK for Coinbase commerce
GPL-3.0-or-later
php rest sdk crypto coinbase commerce api v1