Omnipay driver for the BTCPayServer Bitcoin payment processor
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements BTCPayServer support for Omnipay.
This library should just wrap around the tutorial notes from the btcpayserver lib: https://github.com/btcpayserver/php-bitpay-client/blob/master/examples/tutorial/003_createInvoice.php
- Patch key-generation and pairing scripts from btcpayserver/btcpayserver-php-client lib and ref them in this README
- See PHP and library dependencies in
composer.json
- A
.env
file used to manage environment variables
This Omnipay driver is installed via Composer. To install it, simply add it
to your composer.json
file or just run composer require dcentrica/omnipay-btcpayserver
{
"require": {
"dcentrica/omnipay-btcpayserver": "dev-master"
}
}
This library assumes you're using a .env
file for your application configuration. Adapt the following example to suit your environment:
# Hostname of your BTCPayServer instance
BTCPAYSERVER_HOST="testnet.demo.btcpayserver.org"
# Default web store fiat currency
BTCPAYSERVER_STORE_DEFAULT_CURRENCY="NZD"
# A URL for returning shoppers back to your website after a successful purchase
BTCPAYSERVER_STORE_REDIRECT="https://pay.my-store.nz/"
# Optional: IPN notifications are sent here (if set)
BTCPAYSERVER_STORE_CALLBACK="https://my-store.nz/ipncallback/"
# Generated by https://github.com/btcpayserver/btcpayserver-php-client/blob/master/examples/tutorial/002_pair.php
BTCPAYSERVER_INVOICE_TOKEN="A2YbWgnBnEtRhX2UIqJHNvaMp2tt11AzbMiNLLJ9AKK"
# Used to encrypt public & private keys
BTCPAYSERVER_CONF_ENC_PASS="YourTopSecretPassword"
# Absolute path to the private-key, generated according to
# https://github.com/btcpayserver/btcpayserver-php-client/blob/master/examples/tutorial/001_generateKeys.php
BTCPAYSERVER_PRIKEY_LOC="/tmp/btcpay.pri"
# Absolute path to the public-key, generated according to
# https://github.com/btcpayserver/btcpayserver-php-client/blob/master/examples/tutorial/001_generateKeys.php
BTCPAYSERVER_PUBKEY_LOC="/tmp/btcpay.pub"
# Test BTCPayServer endpoint
BTCPAYSERVER_ENDPOINT_TEST="https://testnet.demo.btcpayserver.org/"
# Live BTCPayServer endpoint
BTCPAYSERVER_ENDPOINT_LIVE="https://demo.btcpayserver.org/"
# Optionally receive emails at this address when purchases are made
BTCPAYSERVER_STORE_NOTIFICATION_EMAIL="[email protected]
If you want to display payment QR codes in a modal within your web store, a little JavaScript is required, an example is below:
<script src="//my.btcpayserver.instance.com/modal/btcpay.js"></script>
<script src="/path/to/my/jsquery.min.js"></script>
<script>
// As an example, `invoiceId` could be configured to come through as a GET param
// The jQuery selector should identify the checkout button of your store
$('#my-checkout-button').on('click', function(e) { window.btcpay.showInvoice(invoiceId); });
</script>
The following gateways are provided by this package:
- BTCPayServer
For general Omnipay usage instructions, please see the main Omnipay repository. For BTCPayServer usage instructions, please see the main BTCPayServer repository and the comprehensive docs.
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug with Omnipay itself, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
If you believe you have found a bug with this driver, please report it using our GitHub issue tracker.
For help with BTCPayServer:
- visit the website
- Sign-up to the Mattermost channels.