PHPackages                             payaccept/laravel-paychain - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. payaccept/laravel-paychain

ActiveProject[Payment Processing](/categories/payments)

payaccept/laravel-paychain
==========================

Laravel package for implementing PayChain blockchain

1.0.7(4y ago)04MITPHPPHP &gt;=7.3

Since Sep 27Pushed 4y agoCompare

[ Source](https://github.com/PayAccept/laravel-paychain)[ Packagist](https://packagist.org/packages/payaccept/laravel-paychain)[ RSS](/packages/payaccept-laravel-paychain/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (7)Used By (0)

laravel-paychain
================

[](#laravel-paychain)

Package for receive payments via PayChain

Prerequisites
-------------

[](#prerequisites)

**Laravel version &gt;= 7.3**

There is lot of docs about installing Laravel, not covered here ...

**Running Paychain server**

You can find docs here :

The Paychain node is based on bitcoin-core-0.16

Installation
------------

[](#installation)

First, make laravel application :

```
laravel new first-paychain-app

```

then cd in first-bitcoin-app:

```
cd first-paychain-app

```

Install package via composer:

```
composer require payaccept/laravel-paychain

```

After installation publish package with artisan command :

```
php artisan vendor:publish

```

and choose by tag **paychain**.

In config folder you'll find new config file - **paychain.php**You can change values in file directly, but most common way is to put values in Laravel **.env** file, like this :

```
// Put this at the end of .env file
PAYCHAIN_HOST=127.0.0.1 // change this with host of Paychain server
PAYCHAIN_PORT=8554
PAYCHAIN_USER=rpcusername // change this with rpc user name from bitcoin config
PAYCHAIN_PASSWORD=rpcuserpassword  //change this with rpc passord from bitcoin config
PAYCHAIN_MIN_CONFIRMATIONS=3  // This is minimal number of confirmations - do some google about bitcoin confirmations if you not shure about this value

```

Next, run migrations :

```
php artisan migrate

```

Usage
-----

[](#usage)

There are two main objects in package :

**1. PayAccept\\LaravelPaychain\\Paychain** - this is a wrapper for RPC commands to bitcoin server. You can make this object via Laravel **app** helper function like this:

```
$paychain = app("paychain");
// or
$paychain = app("PayAccept\LaravelPaychain\Paychain");

```

and then call RPC method on object :

```
$payaddress = $paychain->getnewaddress();

```

You can use just this object for simpler projects ...

**2. PayAccept\\LaravelPaychain\\Models\\Payment** - this object is model for payment with Paychain , creates for you new Paychain address, amount, track if customer made payment, store it to database ...

Again, use **app** helper function like this:

```
$payment = app("PayAccept\LaravelPaychain\Models\Payment");
//or
$payment = app("paychainPayment");

```

This object contains following properties:

**user\_id** - id of user who made order

**order\_id** - order id (not mandatory)

**address** - bitcoin address (this is automatically generated for you when you call $payment = app("bitcoinPayment"))

**paid** - this is indicator if user is made payment and number of confirmations on block chain is ok (there is configuration parameter for minimum number of confirmations PAYCHAIN\_MIN\_CONFIRMATIONS in .env file or directly in paychain.conf file in config folder)

**amount** - price that user need to pay

**amount\_received** - amount of bitcoin that is actually received (some user can make mistake and send bitcoins with fee deducted from amount send from their wallet, than you wont get expected amount)

**txid** - transaction id in block chain for this payment (this is populated in database when user actually make payment)

**confirmations** - number of confirmations for payment.

### Typical workflow

[](#typical-workflow)

When order is made by user, you make new Payment object and populate its properties :

```
// Most likely you'll use code like this in some of your Controllers

$payment = app("paychainPayment");
$payment->user_id = $user->id;
$payment->amount = 0.05; // this is price for order or item
$payment->save();

```

#### Checking payments and confirmations:

[](#checking-payments-and-confirmations)

Package contains class PayAccept\\LaravelPaychain\\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

[](#listening-for-payments)

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

**ConfirmedPaymentListener.php**

**UnconfirmedPaymentListener.php**

**UnknownTransactionListener.php**

Each of these Listeners correspond to Events which are placed in vendor folder of project : **vendor\\payaccept\\laravel-paychain\\src\\Events**

**ConfirmedPaymentEvent.php**

**UnconfirmedPaymentEvent.php**

**UnknownTransactionEvent.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',
        ],

        'PayAccept\LaravelPaychain\Events\ConfirmedPaymentEvent' => [
            'App\Listeners\ConfirmedPaymentListener',
        ],

        'PayAccept\LaravelPaychain\Events\UnconfirmedPaymentEvent' => [
            'App\Listeners\UnconfirmedPaymentListener',
        ],

        'PayAccept\LaravelPaychain\Events\UnknownTransactionEvent' => [
            'App\Listeners\UnknownTransactionListener',
        ],

    ];

```

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 PAYCHAIN\_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

[](#events)

1. **PayAccept\\LaravelPaychain\\Events\\UnconfirmedPaymentEvent** - Payment is made by user. Transaction id is generated on block chain, number of conifrmation on block chain is 0 - so you have to wait for additional confirmations.
2. **PayAccept\\LaravelPaychain\\Events\\ConfirmedPaymentEvent** - Payment is made and number of confirmations is equal or greater than value of **PAYCHAIN\_MIN\_CONFIRMATIONS** in .env file.
3. **PayAccept\\LaravelPaychain\\Events\\UnknownTransactionEvent** - Usually this happens when user make payment and transaction fee is deducted from amount that he sends from his wallet and you don't receive whole amount. This payments are stored in separate table and you can make logic how to resolve situation like this.

### Models

[](#models)

**PayAccept\\LaravelPaychain\\Models\\Payment** - Represents Confirmed and Unconfirmed Payments (see Usage section)

**PayAccept\\LaravelPaychain\\Models\\UnknownTransaction** - Represent transaction on block chain with amount that does not correspond to amount in Payment model.

License
-------

[](#license)

MIT License

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Total

6

Last Release

1624d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e629d697c64f0b5bc28f6fa1e948380e041c7041fb1602507b8553bc92970b73?d=identicon)[dcnl1980](/maintainers/dcnl1980)

---

Top Contributors

[![moki74](https://avatars.githubusercontent.com/u/12022967?v=4)](https://github.com/moki74 "moki74 (22 commits)")[![dcnl1980](https://avatars.githubusercontent.com/u/8920270?v=4)](https://github.com/dcnl1980 "dcnl1980 (12 commits)")[![hbmaulikgajjar](https://avatars.githubusercontent.com/u/90825873?v=4)](https://github.com/hbmaulikgajjar "hbmaulikgajjar (4 commits)")[![osthafen](https://avatars.githubusercontent.com/u/525826?v=4)](https://github.com/osthafen "osthafen (2 commits)")[![Zwist](https://avatars.githubusercontent.com/u/19359990?v=4)](https://github.com/Zwist "Zwist (1 commits)")

### Embed Badge

![Health badge](/badges/payaccept-laravel-paychain/health.svg)

```
[![Health](https://phpackages.com/badges/payaccept-laravel-paychain/health.svg)](https://phpackages.com/packages/payaccept-laravel-paychain)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
