Package Data | |
---|---|
Maintainer Username: | yani- |
Maintainer Contact: | yani@iliev.me (Yani Iliev) |
Package Create Date: | 2015-08-29 |
Package Last Update: | 2017-10-18 |
Language: | PHP |
License: | BSD-2-Clause |
Last Refreshed: | 2024-12-22 15:02:56 |
Package Statistics | |
---|---|
Total Downloads: | 117 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 1 |
Total Forks: | 2 |
Total Open Issues: | 0 |
A simple Laravel package for processing payments via Coinbase
You can install the package using the Composer package manager. Assuming you have Composer installed globally:
composer require yani/coinbase:0.*
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',
),
Publish the configuration with
php artisan config:publish yani/coinbase
This will add the boilerplate configuration to app/config/packages/yani/coinbase/config.php
.
$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();
}
MIT