btcpay python client
Branch: master
Clone or download
Latest commit 6d572dc Jan 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
btcpay Prepare Prior PR #4 for PyPI to Make It Installable (#5) Jan 17, 2019
.gitignore version bump Jan 17, 2019
LICENSE switched to MIT license Mar 7, 2018 Update Jan 18, 2019 match name Jan 17, 2019



pip3 install btcpay-python

If you were a user of the prior unofficial client library for Python, you would need to uninstall it first:

pip3 uninstall btcpay
pip3 install btcpay-python

This library is fully backward compatibile with the prior unofficial library; no code changes are needed.

The "easy method" to create a new BTCPay client

  • On BTCPay server > shop > access tokens > create new token, copy pairing code.
  • Then use that code in the below Python code:
from btcpay import BTCPayClient

client = BTCPayClient.create_client(host='', code=<pairing-code>)

Creating a client the manual way (not necessary if you used the 'easy' method)

  • Generate and save private key:
import btcpay.crypto
privkey = btcpay.crypto.generate_privkey()
  • Create client:
from btcpay import BTCPayClient
client = BTCPayClient(host='http://hostname', pem=privkey)
  • On BTCPay server > shop > access tokens > create new token, copy pairing code:
  • Pair client to server and save returned token:
>>> {'merchant': "xdr9vw3v5wc0w90859v45"}
  • Recreate client:
client = BTCPayClient(
    tokens={'merchant': "xdr9vw3v5wc0w90859v45"}

Get rates


Create specific rate


Create invoice

See bitpay api documentation:

client.create_invoice({"price": 20, "currency": "USD"})

Get invoice