Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeblackwaslike/btcpay-python
btcpay python client
https://github.com/joeblackwaslike/btcpay-python
Last synced: about 2 months ago
JSON representation
btcpay python client
- Host: GitHub
- URL: https://github.com/joeblackwaslike/btcpay-python
- Owner: joeblackwaslike
- License: mit
- Created: 2018-03-07T23:08:21.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T00:07:21.000Z (almost 7 years ago)
- Last Synced: 2024-10-14T06:30:15.739Z (3 months ago)
- Language: Python
- Size: 31.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# btcpay-python
## Install
```shell
pip3 install btcpay
```## Pairing
* Generate and save private key:
```python
import btcpay.crypto
privkey = btcpay.crypto.generate_privkey()
```
* Create client:
```python
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:
```python
client.pair_client()
>>> {'merchant': "xdr9vw3v5wc0w90859v45"}
```
* Recreate client:
```python
client = BTCPayClient(
host='http://hostname',
pem=privkey,
tokens={'merchant': "xdr9vw3v5wc0w90859v45"}
)
```## Creating a client
```python
client = BTCPayClient(
host='http://hostname',
pem=privkey,
tokens={'merchant': "xdr9vw3v5wc0w90859v45"}
)
```## Get rates
```python
client.get_rates()
```## Create specific rate
```python
client.get_rate('USD')
```## Create invoice
See bitpay api documentation: https://bitpay.com/api#resource-Invoices
```python
client.create_invoice({"price": 20, "currency": "USD"})
```## Get invoice
```python
client.get_invoice()
```