symm / guzzle-bitpay
v1.1.2
2014-07-05 13:03 UTC
Requires
- guzzle/guzzle: >=3.7.1,~3.9.0
- psr/log: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2022-02-01 12:28:49 UTC
README
使用 BitPay API 和 Guzzle 将 BitPay 支付处理支持添加到您的 PHP 应用程序中(BitPay API) 和 (Guzzle)
安装
在您的 composer.json 文件中要求库
{ "require": { "symm/guzzle-bitpay": "~1.0" } }
使用方法
创建一个客户端
use Symm\BitpayClient\BitpayClient; $client = BitpayClient::createClient('YOUR_API_KEY_HERE');
创建一个测试环境客户端
与 测试环境 通信的客户端
use Symm\BitpayClient\BitpayClient; $client = BitpayClient::createTestClient('YOUR_TEST_API_KEY_HERE');
创建一个新的发票
$invoice = $client->createInvoice( array( 'price' => 5, 'currency' => 'GBP', ) ); print $invoice->getUrl() . PHP_EOL;
接收一个现有的发票
$invoice = $client->getInvoice( array( 'id' => 'YOUR_INVOICE_ID_HERE' ) ); print $invoice->getStatus() . PHP_EOL;
验证 BitPay 通知
$invoice = $client->verifyNotification(file_get_contents("php://input"));
获取汇率
$currencyCollection = $client->getRates(); foreach ($currencyCollection as $currency) { /** @var \Symm\BitpayClient\Model\Currency $currency */ print $currency->getCode() . ': ' . $currency->getRate(); }
本地化发票页面
use Symm\BitpayClient\Localisation\Language; print $invoice->getUrl(Language::SPANISH)
资源
版权和许可
代码版权属于 Gareth Jones 并在 MIT 许可证 下发布。