项目作者: aimagician

项目描述 :
A simple Laravel 5 wrapper for Bitpay
高级语言: PHP
项目地址: git://github.com/aimagician/bitpaymagic.git
创建时间: 2018-03-31T17:11:53Z
项目社区:https://github.com/aimagician/bitpaymagic

开源协议:MIT License

下载


bitpaymagic

Simple Laravel 5 wrapper for the Bitpay php client

Installation

Add this package to your project, with Composer

  1. composer require aimagician/bitpaymagic

Configuration

Run the following command to have Laravel set up a configuration file for you.

  1. 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.

  1. BITPAY_STORAGE_PASS=YourTopSecretPassword
  2. BITPAY_PAIRING_CODE=YourPairingCode
  3. BITPAY_PAIRING_CODE_LABEL="Test Token Label - optional"
  4. BITPAY_ENV=testnet
  5. BITPAY_GENERATED_TOKEN="Put here generated token"

Pairing code can be setup here in: Payment Tools -> Manage API tokens -> Add new token -> Add token

To generate needed keys

run this artisan command, and update generated token value in .env file(BITPAY_GENERATED_TOKEN)

  1. 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.

Trait

A Bitpaymagic Trait initBitpaymagicClient() function will return a client

  1. use BitpaymagicTrait;
  2. ...
  3. ...
  4. $client = $this->initBitpaymagicClient();

Facades

Simply use Laravel facades:

  1. use Bitpay\Buyer;
  2. use Bitpay\Currency;
  3. use Bitpay\Invoice;
  4. use Bitpay\Item;

Bitpay documentation

How to setup test environment

A full working example: https://github.com/aimagician/bitpay-test