bitpaymagic
Simple Laravel 5 wrapper for the Bitpay php client, (*1)
Installation
Add this package to your project, with Composer, (*2)
composer require aimagician/bitpaymagic
Configuration
Run the following command to have Laravel set up a configuration file for you., (*3)
php artisan vendor:publish
This will create in config folder a "bitpaymagic.php" config file. Config file uses a .env variables.
Update .env file with these keys., (*4)
BITPAY_STORAGE_PASS=YourTopSecretPassword
BITPAY_PAIRING_CODE=YourPairingCode
BITPAY_PAIRING_CODE_LABEL="Test Token Label - optional"
BITPAY_ENV=testnet
BITPAY_GENERATED_TOKEN="Put here generated token"
Pairing code can be setup here in: Payment Tools -> Manage API tokens -> Add new token -> Add token, (*5)
To generate needed keys, (*6)
run this artisan command, and update generated token value in .env file(BITPAY_GENERATED_TOKEN), (*7)
php artisan bitpaymagic:setup
This step is needed to run just once, if error is being shown, please revoke and update pairing code, and try again,
or follow this tutorial and do everything manually., (*8)
Trait
A Bitpaymagic Trait initBitpaymagicClient()
function will return a client, (*9)
use BitpaymagicTrait;
...
...
$client = $this->initBitpaymagicClient();
Facades
Simply use Laravel facades:, (*10)
use Bitpay\Buyer;
use Bitpay\Currency;
use Bitpay\Invoice;
use Bitpay\Item;
Bitpay documentation, (*11)
How to setup test environment, (*12)
A full working example: https://github.com/aimagician/bitpay-test, (*13)