yani/coinbase

A simple Laravel 4 package for processing bitcoin payments via Coinbase

2.0 2017-10-18 12:36 UTC

This package is auto-updated.

Last update: 2024-10-28 06:39:37 UTC


README

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads

A simple Laravel package for processing payments via Coinbase

Requirements

  • PHP 5.4 or greater
  • Laravel 4.1 or greater

Installation

You can install the package using the Composer package manager. Assuming you have Composer installed globally:

composer require yani/coinbase:0.*

Service provider and alias

Next, add the Yani\Coinbase\CoinbaseServiceProvider service provider to the providers array in your app/config.php file.

'providers' => array(
  ...
  'Yani\Coinbase\CoinbaseServiceProvider',
),

and then add the facade to your aliases array in your app/config.php file.

'aliases' => array(
  ...
  'Coinbase' => 'Yani\Coinbase\Facades\Coinbase',
),

Configuration

Publish the configuration with

php artisan config:publish yani/coinbase

This will add the boilerplate configuration to app/config/packages/yani/coinbase/config.php.

Usage

$amount   = 100;
$currency = 'USD';
$name     = 'Order #1';
try
{
	$checkout = Coinbase::createCheckout($amount, $currency, $name);
	echo $checkout->id;         // ffc93ba1-874d-5c55-853c-53c9c4814b1e
	echo $checkout->embed_code; // af0b52802ad7b36806e307b2d294e3b4
	// You can find a full list of the response here: https://developers.coinbase.com/api/v2#create-checkout
}
catch (CoinbaseCheckoutException $e)
{
	echo "The order failed because: " . $e->getMessage();
}

License

MIT