PHPackages                             coinsnap/php-library - 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. coinsnap/php-library

ActiveLibrary[Payment Processing](/categories/payments)

coinsnap/php-library
====================

This API library is created for PHP developers to connect online store to Coinsnap payment gateway fast and easy

00PHP

Since Oct 7Pushed 7mo agoCompare

[ Source](https://github.com/Coinsnap/Coinsnap-PHP-Library)[ Packagist](https://packagist.org/packages/coinsnap/php-library)[ RSS](/packages/coinsnap-php-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Coinsnap is a Lightning payment provider and offers a payment gateway for processing Bitcoin and Lightning payments. A merchant only needs a Lightning wallet with a lightning address to accept Bitcoin and Lightning payments on their website.

Coinsnap PHP Library
====================

[](#coinsnap-php-library)

Coinsnap API library for PHP 7.4+

This API library is created for PHP developers to connect online store to Coinsnap payment gateway fast and easy. You can include this library inside your plug-in or use it as plugin inside your system.

5 steps to receive payments in via Bitcoin/Lightning payment gateway
====================================================================

[](#5-steps-to-receive-payments-in-via-bitcoinlightning-payment-gateway)

1. Registration in Coinsnap App
2. Settings saving and payment statuses matching
3. Connecting to Coinsnap App and Webhook saving
4. Invoice and payment link receiving
5. Payment status update

1. Registration in Coinsnap App
===============================

[](#1-registration-in-coinsnap-app)

Register you account on [Coinsnap App](https://app.coinsnap.io), fill all the necessary fields and receive Store Id and API Key.

2. Settings saving and payment statuses matching
================================================

[](#2-settings-saving-and-payment-statuses-matching)

You need to save Store Id and API Key in your database as Coinsnap connection configuration. Later you'll add there webhook data. If your store has reserved payment statuses, you can match your payment statuses to Coinsnap's:

- New - for new invoice
- Processing - for invoice in processing
- Settled - for paid invoice
- Expired - for expired invoice

If you can add Coinsnap payment statuses to existing, you can do it too. It depends of your system.

3. Connecting to Coinsnap App and Webhook saving
================================================

[](#3-connecting-to-coinsnap-app-and-webhook-saving)

Every request to Coinsnap App needs necessary headers:

'Accept': 'application/json', 'Content-Type': 'application/json', 'x-api-key': «API Key»

The method Coinsnap\\Client\\AbstractClient::getRequestHeaders() creates them automatically.

3.1. Check connection to Coinsnap by the method Coinsnap\\Client\\Store::getStore(«Store ID»).

3.2. If Coinsnap server is available, we can create webhook by the method Coinsnap\\Client\\Webhook::createWebhook(«Store ID»,«Callback URL»), where «Callback URL» - URL for payment status updates via callback from Coinsnap server.

If webhook is created successfully, you will receive JSON-object with webhook data: {'id', 'secret', 'url'}. You need to store it in your database as an object or in separate fields.

3.3. You don't need to create webhook every time when you save your connection features, but you can check it by the method Coinsnap\\Client\\Webhook::getWebhook( «Store ID», «Webhook ID» ); Webhook ID is an id parameter, that you have received early on webhook creation stage. If webhook exists, you don't need to create it again.

3.4. If your Coinsnap credentians have been changed, you need to update webhook by the method updateWebhook(«Store ID»,«Webhook URL»,«Webhook ID»); Please save updates webhook data from JSON-object with webhook data: {'id', 'secret', 'url'} over old values.

4. Invoice and payment link receiving
=====================================

[](#4-invoice-and-payment-link-receiving)

You don't need to change your catalog, basket and order mechanism, but there will be necessary changes on the checkout stage. You your user has chosen "Bitcoin + Lightning" as payment method, you need to request invoice from Coinsnap App by method Coinsnap\\Client\\Invoice\\createInvoice(«Store ID»,«Currency»,«Amount»,«Order ID»,«Buyer e-mail»,«Customer name»,«Redirect URL») in short variant.

After sending invoice request you will receive payment link and QR-codes for payment in Lightning or Bitcoin. You need to store in order or transaction data received Invoice ID to check payment statuses on fifth step.

5. Payment status update
========================

[](#5-payment-status-update)

After invoice creation and payment receiving Coinsnap App will connect to callback URL that you have sent to Coinsnap earlier. The body of the request is JSON-object {"type":«Payment status»,"invoiceId":«Invoice ID»}. You can check signature, sent in header «x-coinsnap-sig» to ensure that request is sent by Coinsnap and update paynebt status inside your webshop.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance44

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![adagiomedia](https://avatars.githubusercontent.com/u/59640052?v=4)](https://github.com/adagiomedia "adagiomedia (13 commits)")

### Embed Badge

![Health badge](/badges/coinsnap-php-library/health.svg)

```
[![Health](https://phpackages.com/badges/coinsnap-php-library/health.svg)](https://phpackages.com/packages/coinsnap-php-library)
```

###  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)
