承接 wangta69/btc-payment 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wangta69/btc-payment

Composer 安装命令:

composer require wangta69/btc-payment

包简介

Payment system for btc with bitcoind

README 文档

README

Prerequisites

Laravel version >= 5.5

Install package via composer:

composer require wangta69/btc-payment
$btc = app("Pondol\BtcPayment\Bitcoind");
protected $btc;
/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct(Bitcoind $btc)
{
    $this->btc = $btc;
    $this->btc->getaccountaddress("");
}

OR

public function getaccountaddress() {
    $btc = app("Pondol\BtcPayment\Bitcoind");
    return $btc->getaccountaddress("37");
}

Checking payments and confirmations:

Package contains class Pondol\BtcPayment\Commands\CheckPayment. This is Laravel Command and you can call it via php artisan :

php artisan bitcoin:checkpayment

Each time you call it, it scan for payments and confirmations on block chain. You can call it manually for testing purposes like mentioned above , but there is no much sense to do so, because it's job is to check for payments and it needs to run always.

You need to make crontab entry on linux servers or task scheduler on Win servers to call this command every minute.

// Example for linux
crontab -e

// add this line to cron tab and replace path
* * * * * cd /path/to/your/project/ php artisan bitcoin:checkpayment >/dev/null 2>&1

This script also fires events that we can listen ...

Listening for payments

You'll find new classes in app\Listeners folder of your app when you published pakage ( see installation section). this is :

ConfirmedPaymentListener.php

To activate these Listeners copy this code in app\Providers\EventServiceProvider.php class (this class exists by default installation of Laravel), in $listen attribute of this class.

Like this:

protected $listen = [
        'App\Events\Event' => [
            'App\Listeners\EventListener',
        ],

        'Pondol\BtcPayment\Events\ConfirmedPaymentEvent' => [
            'App\Listeners\ConfirmedPaymentListener',
        ],
    ];

In each of these class there is handle method, where you can put logic for actions that need to be done when event is fired (DB insert-update, sending mails ...).

Below is example of ConfimedPaymentListener, event is generated when number of confirmations is equal to BITCOIND_MIN_CONFIRMATIONS in .env file and we can be sure that payment is ok.

    public function handle(ConfirmedPaymentEvent $event)
    {
        Log::debug('Confirmed Payment listener: '. $event->confirmedPayment);
         // Here you add your code for sending mails, db update ...
    }

Events

  1. Pondol\BtcPayment\Events\ConfirmedPaymentEvent - Payment is made and number of confirmations is equal or greater than value of BITCOIND_MIN_CONFIRMATIONS in .env file.

Models

Pondol\BtcPayment\Models\Payment - Represents Confirmed and Unconfirmed Payments (see Usage section)

License

MIT License

wangta69/btc-payment 适用场景与选型建议

wangta69/btc-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 wangta69/btc-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wangta69/btc-payment 我们能提供哪些服务?
定制开发 / 二次开发

基于 wangta69/btc-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-22