-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bac798d
commit 380bc54
Showing
46 changed files
with
1,280 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
# Coinbase commerce PHP8 | ||
Coinbase commerce library for PHP8. works in Laravel8 | ||
|
||
Coinbase commerce library for PHP8. works in Laravel8 | ||
|
||
Library is based in https://commerce.coinbase.com/docs/api/ | ||
|
||
\*\*NOTE: help me improve this repo | ||
|
||
# Installation | ||
|
||
marcialpaulg/coinbase-commerce-php8 is available in [Packagist](https://packagist.org/), and installation via [Composer](https://getcomposer.org/) | ||
|
||
run | ||
`composer require marcialpaulg/coinbase-commerce-php8` | ||
|
||
Note that the vendor folder and the `vendor/autoload.php` script are generated by `Composer`; they are not part of this library. | ||
|
||
# Usage | ||
|
||
check our [examples](https://github.com/marcialpaulg/coinbase-commerce-php8/tree/main/examples) | ||
|
||
# License | ||
|
||
marcialpaulg/coinbase-commerce-php8 is open-sourced software licensed under the [MIT license](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "marcialpaulg/coinbase-commerce-php8", | ||
"description": "Coinbase commerce PHP8 library", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Marcial Paul Gargoles", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.0", | ||
"guzzlehttp/guzzle": "^7.0.1", | ||
"illuminate/collections": "^8.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"MarcialPaulG\\Coinbase\\": "src/" | ||
} | ||
}, | ||
"prefer-stable": true, | ||
"minimum-stability": "dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
// Your API KEY | ||
$api_key = 'YOUR_API_KEY'; | ||
|
||
// throw exception | ||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
$charge_code_id = 'CHARGE_CODE_OR_CHARGE_ID'; | ||
|
||
try { | ||
|
||
$data = $coinbase->cancelCharge($charge_code_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Charge; | ||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
|
||
$charge = new Charge( | ||
name: "The Sovereign Individual", | ||
description: "Mastering the Transition to the Information Age", | ||
pricing_type: "fixed_price", | ||
amount: "100.00", | ||
currency: "USD", | ||
metadata: [ | ||
"customer_id" => "id_1005", | ||
"customer_name" => "Satoshi Nakamoto" | ||
], | ||
redirect_url: "https://charge/completed/page", | ||
cancel_url: "https://charge/canceled/page" | ||
); | ||
|
||
$data = $coinbase->request($charge); | ||
|
||
// OR | ||
|
||
$data = $coinbase->createCharge( | ||
name: "The Sovereign Individual", | ||
description: "Mastering the Transition to the Information Age", | ||
pricing_type: "fixed_price", | ||
amount: "100.00", | ||
currency: "USD", | ||
metadata: [ | ||
"customer_id" => "id_1005", | ||
"customer_name" => "Satoshi Nakamoto" | ||
], | ||
redirect_url: "https://charge/completed/page", | ||
cancel_url: "https://charge/canceled/page" | ||
); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Checkout; | ||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
$checkout = new Checkout( | ||
name: "The Sovereign Individual", | ||
description: "Mastering the Transition to the Information Age", | ||
pricing_type: "fixed_price", | ||
amount: "100.00", | ||
currency: "USD", | ||
requested_info: ['email', 'name'], | ||
); | ||
|
||
$data = $coinbase->request($checkout); | ||
|
||
// OR | ||
|
||
$data = $coinbase->createCheckout( | ||
name: "The Sovereign Individual", | ||
description: "Mastering the Transition to the Information Age", | ||
pricing_type: "fixed_price", | ||
amount: "100.00", | ||
currency: "USD", | ||
requested_info: ['email', 'name'], | ||
); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
use MarcialPaulG\Coinbase\Invoice; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
|
||
$invoice = new Invoice( | ||
business_name: "The Sovereign Individual", | ||
customer_email: "[email protected]", | ||
amount: "100.00", | ||
currency: "USD", | ||
customer_name: "Mars", | ||
memo: "for test" | ||
); | ||
|
||
$data = $coinbase->request($invoice); | ||
|
||
// OR | ||
|
||
$data = $coinbase->createInvoice( | ||
business_name: "The Sovereign Individual", | ||
customer_email: "[email protected]", | ||
amount: "100.00", | ||
currency: "USD", | ||
customer_name: "Mars", | ||
memo: "for test" | ||
); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
|
||
$checkout_id = 'CHECKOUT_ID'; | ||
|
||
$data = $coinbase->deleteCheckout($checkout_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
$charge_code_id = 'CHARGE_CODE_OR_CHARGE_ID'; | ||
|
||
$data = $coinbase->getCharge($charge_code_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
|
||
$checkout_id = 'CHECKOUT_ID'; | ||
|
||
$data = $coinbase->getCheckout($checkout_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
$event_id = 'EVENT_ID'; | ||
|
||
$data = $coinbase->getEvent($event_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
$invoice_code_id = 'INVOICE_CODE_OR_INVOICE_ID'; | ||
|
||
$data = $coinbase->getInvoice($invoice_code_id); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
require '../vendor/autoload.php'; | ||
|
||
use MarcialPaulG\Coinbase\Coinbase; | ||
use MarcialPaulG\Coinbase\Exceptions\InvalidRequestException; | ||
use MarcialPaulG\Coinbase\Exceptions\RateLimitExceededException; | ||
|
||
$api_key = 'YOUR_API_KEY'; | ||
|
||
$throw_exceptions = true; | ||
|
||
$coinbase = new Coinbase($api_key, $throw_exceptions); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
try { | ||
|
||
$data = $coinbase->listCharges(); | ||
} catch (InvalidRequestException | RateLimitExceededException $e) { | ||
|
||
echo $e->getMessage(); | ||
} |
Oops, something went wrong.