sescandell/bitpay-client
Composer 安装命令:
composer require sescandell/bitpay-client
包简介
BitPay PHP Client
README 文档
README
Powerful, flexible, lightweight interface to the BitPay Bitcoin Payment Gateway API.
Installing via Composer
The recommended way to install the BitPay PHP Client is through Composer.
# Install Composer $ curl -sS https://getcomposer.org/installer | php # Add BitPay as a dependency $ php composer.phar require bitpay/php-client
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
The library requires PHP 5.3+ and is PSR-0 compatible.
Basic Usage
To create an invoice:
<?php require 'vendor/autoload.php'; $bitPay = new BitPay\BitPay( new BitPay\Request\Curl, new BitPay\Encrypter\Hash('API-KEY'), 'API-KEY', $options // array, optional ); $invoice = $bitPay->createInvoice($orderID, $price); // returns Invoice Object
With invoice creation, orderID and currency are the only required fields. If you are sending a customer from your website to make a purchase, setting redirectURL on BitPay constructor options is required.
Response will be an object with information on your newly created invoice. Send your customer to the url to complete payment:
class stdClass#5 (10) { public $id => string(10) "EXAMPLE-ID" public $url => string(40) "https://bitpay.com/invoice?id=EXAMPLE-ID" public $posData => string(67) "{"posData":[],"hash":"HASH"}" public $status => string(3) "new" public $btcPrice => string(6) "1.0000" public $price => int(1) public $currency => string(3) "BTC" public $invoiceTime => int(1386958726781) public $expirationTime => int(1386959626781) public $currentTime => int(1386958726861) }
There are many options available when creating invoices, which are listed in the BitPay API documentation.
To get updated information on this invoice, make a get call with the ID returned:
<?php require 'vendor/autoload.php'; $bitPay = new BitPay\BitPay( new BitPay\Request\Curl, new BitPay\Encrypter\Hash('API-KEY'), 'API-KEY', $options // array, optional ); $invoice = $bitPay->createInvoice($orderID); // returns Invoice Object
Options
When you instantiate BitPay you can pass options as a fourth argument. You can also set this options dinamically with setOptions().
Please look carefully through these options and adjust according to your installation.
| Option | Default | Description |
|---|---|---|
| verifyPost | true |
Whether to verify POS data by hashing above api key. If set to false, you should have some way of verifying that callback data comes from bitpay.com. |
| notificationEmail | '' |
Email where invoice update notifications should be sent. |
| notificationURL | '' |
URL where bit-pay server should send update notifications. See API doc for more details. |
| redirectURL | '' |
URL where the customer should be directed to after paying for the order. |
| currency | 'BTC' |
This is the currency used for the price setting. A list of other pricing currencies supported is found at bitpay.com |
| physical | true |
Indicates whether anything is to be shipped with the order (if false, the buyer will be informed that nothing is to be shipped) |
| fullNotifications | true |
If set to false, then notificaitions are only sent when an invoice is confirmed (according the the transactionSpeed setting). If set to true, then a notification will be sent on every status change. |
| transactionSpeed | 'low' |
Transaction speed: low/medium/high. See API docs for more details. |
API Documentation
API Documentation is available on the BitPay site.
Running the Tests
$ composer install --dev $ ./vendor/bin/phpunit
In addition to a full test suite, there is Travis integration.
Found a bug?
Let us know! Send a pull request or a patch. Questions? Ask! We're here to help. We will respond to all filed issues.
Authors
- Fede Isas
- Escandell Stéphane
sescandell/bitpay-client 适用场景与选型建议
sescandell/bitpay-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 63.81k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bitcoin」 「bitpay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sescandell/bitpay-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sescandell/bitpay-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sescandell/bitpay-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Library to work with the new cryptographically secure BitPay API (support for Symfony v5)
The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API
BitPay driver for the Omnipay payment processing library
A simple and lightweight bitcoin to currency converter and vice versa based on current exchange rates from your chosen provider: Coinbase, Coindesk, Bitpay and etc.
A Laravel package for connecting to all Iraninan payment gateways
CoinDesk Bitcoin Price Index API for Laravel
统计信息
- 总下载量: 63.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-01-19