PHPackages                             petzsch/laravel-btcpay - 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. [API Development](/categories/api)
4. /
5. petzsch/laravel-btcpay

ActiveLibrary[API Development](/categories/api)

petzsch/laravel-btcpay
======================

BtcPay wrapper for laravel

v7.0.0(5mo ago)101.0k↓100%3MITPHPPHP &gt;=8.1

Since Jun 3Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/petzsch/laravel-btcpay)[ Packagist](https://packagist.org/packages/petzsch/laravel-btcpay)[ Docs](https://github.com/petzsch/laravel-btcpay)[ Fund](https://bit.ly/asja_paypal_lara_bitpay)[ Fund](https://www.buymeacoffee.com/asja)[ RSS](/packages/petzsch-laravel-btcpay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (27)Used By (0)

Laravel BTCPay
==============

[](#laravel-btcpay)

[![LaravelBtcPay Social Image](https://camo.githubusercontent.com/ceff745193c9ea792fa7ad6ee90a68a6b4025da7fca7cafe060e24a514045afd/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c4274635061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7065747a7363682532466c61726176656c2d627463706179267061747465726e3d63697263756974426f617264267374796c653d7374796c655f31266465736372697074696f6e3d5472616e736163742b696e2b426974636f696e2532432b4c697465636f696e2b616e642b31302532422b6f746865722b4274635061792d737570706f727465642b63727970746f63757272656e636965732b77697468696e2b796f75722b4c61726176656c2b6170706c69636174696f6e2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/ceff745193c9ea792fa7ad6ee90a68a6b4025da7fca7cafe060e24a514045afd/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c4274635061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7065747a7363682532466c61726176656c2d627463706179267061747465726e3d63697263756974426f617264267374796c653d7374796c655f31266465736372697074696f6e3d5472616e736163742b696e2b426974636f696e2532432b4c697465636f696e2b616e642b31302532422b6f746865722b4274635061792d737570706f727465642b63727970746f63757272656e636965732b77697468696e2b796f75722b4c61726176656c2b6170706c69636174696f6e2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b270e59db01ceff922d5b114f4cb19f666522ac21c5ff5dbee29ad3359f914ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7065747a7363682f6c61726176656c2d6274637061792e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/petzsch/laravel-btcpay)[![Total Downloads](https://camo.githubusercontent.com/31b0f8250a7d4a661258ec5b8a94d27182e612f4cfefc3158658b915721bb8d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7065747a7363682f6c61726176656c2d6274637061792e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/petzsch/laravel-btcpay)

Laravel BTCPay enables you and your business to transact in Bitcoin, Litecoin and 10+ other BTCPay-supported cryptocurrencies within your Laravel application.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Install Package](#install-package)
    - [Publish config file](#publish-config-file)
    - [Add configuration values](#add-configuration-values)
    - [Interaction with API](#interaction-with-api)
    - [Webhooks](#webhooks)
        - [1. Use package route or define your own](#1-use-package-route-or-define-your-own)
        - [2. Setup your webhook listener](#2-setup-your-webhook-listener)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Laravel 10 or higher

### Install package

[](#install-package)

You can install the package via composer:

```
composer require petzsch/laravel-btcpay
```

### Publish config file

[](#publish-config-file)

Publish config file with:

```
php artisan vendor:publish --provider="Petzsch\LaravelBtcpay\BTCPayServiceProvider"
```

This will create a `btcpay.php` file inside your **config** directory.

### Add configuration values

[](#add-configuration-values)

Add the following keys to your `.env` file and update the values to match your preferences ([read more about configuration](https://github.com/btcpayserver/btcpayserver-greenfield-php#where-to-get-the-api-key-from)):

```
BTCPAY_API_KEY=YourRandomApiKeyThatYouOptainedFromYourBTCPayUserSettings
BTCPAY_SERVER_URL=https://btcpay.your.server.tld
BTCPAY_WEBHOOK_SECRET=YourRandomWebhookSecretString
# Optional, only if you want to use shorthand methods
BTCPAY_STORE_ID=YourBtcPayStoreId
```

### Interaction with API

[](#interaction-with-api)

This package is wrapping the [BTCPay Greenfield PHP SDK](https://github.com/btcpayserver/btcpayserver-greenfield-php), so you can use all features provided by the SDK. You can access the endpoint clients via the `BTCPay` facade. For example, to access the Invoice endpoint client, you can use:

```
use Petzsch\LaravelBtcpay\Support\BTCPay;
use BTCPayServer\Util\PreciseNumber;

/** @var \BTCPayServer\Client\Invoice $invoiceClient */
$invoiceClient = BTCPay::invoice();

$invoiceClient->createInvoice(
    storeId: 'your-store-id',
    currency: 'USD',
    amount: new \BTCPayServer\Util\PreciseNumber('100.00'),
);

// or use the shorthand method provided by the package

$invoice = BTCPay::createInvoice(
    amount: 100.00,
    currency: 'USD',
);
```

### Webhooks

[](#webhooks)

BTCPay resource status updates are completely based on webhooks (IPNs). Laravel BTCPay fully capable of automatically handling webhook requests. Whenever a webhook is received from BTCPay's server, `\Petzsch\LaravelBtcpay\Events\WebhookReceived` event is dispatched. Take the following steps to configure your application for webhook listening:

#### 1. Use package route or define your own

[](#1-use-package-route-or-define-your-own)

By default, package provides a `btcpay/webhook` route that will listen for incoming webhook `POST` requests from BTCPay's server. It automatically verifies the request signature and dispatch event only if it is valid. You can change the default route path in the `btcpay.php` config file by updating the `webhook.prefix` key.

> ℹ️ To retrieve webhook route anywhere in your application, use: `route('btcpay.webhook')`

Alternatively, you can disable the package route by setting `webhook.prefix` to `false` in the `btcpay.php` config file and define your own route in your `routes/web.php` or `routes/api.php` file:

```
use Petzsch\LaravelBtcpay\Http\Controllers\WebhookController;

Route::post('/your-custom-webhook-path', [WebhookController::class, 'handle'])
    ->name('btcpay.webhook')
    ->middleware(\Petzsch\LaravelBtcpay\Http\Middleware\ValidateWebhookSignature::class);
```

#### 2. Setup your webhook listener

[](#2-setup-your-webhook-listener)

Start by generating an event listener:

```
php artisan make:listener BTCPayWebhookListener --event=\Petzsch\LaravelBtcpay\Events\WebhookReceived
```

Then, implement your application-specific logic in the `handle(...)` function of the generated listener.

```
use Petzsch\LaravelBtcpay\Events\WebhookReceived;
use Petzsch\LaravelBtcpay\Enums\WebhookType;
use Illuminate\Support\Arr;

public function handle(WebhookReceived $event): void
{
    match($event->webhook->type) {
        WebhookType::InvoiceSettled => $this->handleInvoiceSettled($event),
        // handle other webhook types...
        default => null,
    };
}

protected function handleInvoiceSettled(WebhookReceived $event): void
{
    // do something with the settled invoice
}
```

Credits
-------

[](#credits)

- [Vaibhavraj Roham](https://github.com/vrajroham)
- [Alex Stewart](https://github.com/alexstewartja)
- [Markus Petzsch](https://github.com/petzsch)
- [021](https://github.com/021-projects)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance70

Regular maintenance activity

Popularity24

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 58% 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 ~124 days

Recently: every ~322 days

Total

23

Last Release

169d ago

Major Versions

v2.0.3 → v3.0.02020-09-25

v3.0.0 → v4.0.02021-07-09

v4.1.2 → v5.0.02021-12-09

v5.0.1 → v6.0.02022-05-14

v6.0.3 → v7.0.02025-11-24

PHP version history (7 changes)1.0.0PHP ^7.1

v1.1.0PHP ^7.0

v1.x-devPHP &gt;=7.0.0

v2.0.1PHP ^7.3

v4.0.0PHP &gt;=7.3 || ^8.0

v6.0.3PHP &gt;=8.0

v7.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/76675f75d6e816f964ca9eef3a4a5e4900f61ece8540091e20febf63dd795987?d=identicon)[petzsch](/maintainers/petzsch)

---

Top Contributors

[![vrajroham](https://avatars.githubusercontent.com/u/12662173?v=4)](https://github.com/vrajroham "vrajroham (51 commits)")[![alexstewartja](https://avatars.githubusercontent.com/u/6935309?v=4)](https://github.com/alexstewartja "alexstewartja (14 commits)")[![021-projects](https://avatars.githubusercontent.com/u/20326979?v=4)](https://github.com/021-projects "021-projects (9 commits)")[![petzsch](https://avatars.githubusercontent.com/u/1374810?v=4)](https://github.com/petzsch "petzsch (7 commits)")[![colbyalbo](https://avatars.githubusercontent.com/u/30237541?v=4)](https://github.com/colbyalbo "colbyalbo (2 commits)")[![iDevelopThings](https://avatars.githubusercontent.com/u/4105581?v=4)](https://github.com/iDevelopThings "iDevelopThings (1 commits)")[![IvanG11](https://avatars.githubusercontent.com/u/1247325?v=4)](https://github.com/IvanG11 "IvanG11 (1 commits)")[![Ririshi](https://avatars.githubusercontent.com/u/8461226?v=4)](https://github.com/Ririshi "Ririshi (1 commits)")[![tsaffi](https://avatars.githubusercontent.com/u/28920873?v=4)](https://github.com/tsaffi "tsaffi (1 commits)")[![beatific-angel](https://avatars.githubusercontent.com/u/64799935?v=4)](https://github.com/beatific-angel "beatific-angel (1 commits)")

---

Tags

laravelbtcbtcpay

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleECS

### Embed Badge

![Health badge](/badges/petzsch-laravel-btcpay/health.svg)

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

###  Alternatives

[rakibdevs/openweather-laravel-api

Laravel package to connect https://openweathermap.org/ to get customized weather data for any location on the globe immediately

7648.2k](/packages/rakibdevs-openweather-laravel-api)

PHPackages © 2026

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