symm/guzzle-bitpay

此包已被废弃且不再维护。作者建议使用bitpay/php-client包。

Bitpay API 的 Guzzle 客户端

v1.1.2 2014-07-05 13:03 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:28:49 UTC


README

Build Status Code Coverage Scrutinizer Quality Score Latest Stable Version Total Downloads Latest Unstable Version License

使用 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)

资源

Guzzle 文档

官方 API 文档

版权和许可

代码版权属于 Gareth Jones 并在 MIT 许可证 下发布。