Skip to content

Commit b0bd6ef

Browse files
authored
#v1.0.2202 - BitPay setup and invoice #1
2 parents 9f5b89d + b918f75 commit b0bd6ef

File tree

137 files changed

+21378
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+21378
-0
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: python
2+
python:
3+
- "3.7"
4+
- "3.8"
5+
- "3.9"
6+
- "3.9-dev"
7+
- "nightly" # nightly build
8+
# command to install dependencies
9+
install:
10+
- pip install -r requirements.txt

GUIDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Using the BitPay Python client
2+
3+
This SDK provides a convenient abstraction of BitPay's [cryptographically-secure API](https://bitpay.com/api) and allows payment gateway developers to focus on payment flow/e-commerce integration rather than on the specific details of client-server interaction using the API. This SDK optionally provides the flexibility for developers to have control over important details, including the handling of private keys needed for client-server communication.
4+
5+
It also implements BitPay's remote client authentication and authorization strategy. No private or shared-secret information is ever transmitted over the wire.
6+
7+
8+
- [Dependencies](GUIDE.md#dependencies)
9+
- [Installation](GUIDE.md#installation)
10+
- [Handling your client private key](GUIDE.md#handling-your-client-private-key)
11+
- [Initializing your BitPay client](GUIDE.md#initializing-your-BitPay-client)
12+
- [Pair your client with BitPay](GUIDE.md#pair-your-client-with-BitPay)
13+
- [Getting Started](GUIDE.md#getting-started)
14+
- [Invoice](docs/invoice.md)
15+
- [Bill](docs/bill.md)
16+
- [Ledger](docs/ledger.md)
17+
- [Payout Recipient](docs/payout-recipient.md)
18+
- [Payouts](docs/payouts.md)
19+
- [Payout Batch](docs/payout-batch.md)
20+
- [Rate](docs/rate.md)
21+
- [Refunds](docs/refunds.md)
22+
- [Settlement](docs/settlement.md)
23+
- [Wallet](docs/wallet.md)
24+
- [Errors](docs/errors.md)
25+
- [Copyright](GUIDE.md#copyright)
26+
27+
## Dependencies
28+
29+
You must have a BitPay merchant account to use this SDK. It's free to [sign-up for a BitPay merchant account](https://bitpay.com/start).
30+
31+
If you need a test account, please visit https://test.bitpay.com/dashboard/signup and register for a BitPay merchant test account. Please fill in all questions, so you get a fully working test account.
32+
If you are looking for a testnet bitcoin wallet to test with, please visit https://bitpay.com/wallet and
33+
create a new wallet.
34+
If you need testnet bitcoin please visit a testnet faucet, e.g. https://testnet.coinfaucet.eu/en/ or http://tpfaucet.appspot.com/
35+
36+
For more information about testing, please see https://bitpay.com/docs/testing
37+
38+
## Installation
39+
40+
1. Download the package and extract it into a local directory or clone the repo.
41+
2. cd into the root directory where setup.py is located
42+
3. Enter: python setup.py install
43+
44+
45+
46+
### Handling your client private key
47+
48+
Each client paired with the BitPay server requires a ECDSA key. This key provides the security mechanism for all client interaction with the BitPay server. The public key is used to derive the specific client identity that is displayed on your BitPay dashboard. The public key is also used for securely signing all API requests from the client. See the [BitPay API](https://bitpay.com/api/) for more information.
49+
50+
The private key should be stored in the client environment such that it cannot be compromised. If your private key is compromised you should revoke the compromised client identity from the BitPay server and re-pair your client, see the [API tokens](https://bitpay.com/api-tokens) for more information.
51+
52+
To generate the configuration file required to load the SDK:
53+
54+
The [BitPay Config Generator](setup/bitpay_setup.py) helps to generate the private key, as well as a environment file formatted in JSON or YML which contains all configuration requirements, that should be stored in the client local file system. It is not recommended to transmit the private key over any public or unsecure networks.
55+
56+
The comments in this script will assist you to create the environment file which you will be able to modify it later.
57+
58+
Once the Config Generator has run and generated the Json/Yml correctly, read the console output and follow the instructions in order to pair your new tokens.
59+
60+
```json
61+
62+
{
63+
"BitPayConfiguration": {
64+
"Environment": "",
65+
"EnvConfig": {
66+
"Test": {
67+
"PrivateKeyPath": "",
68+
"PrivateKey": "",
69+
"ApiTokens": {
70+
"merchant": "",
71+
"payout": ""
72+
},
73+
"proxy": ""
74+
}
75+
}
76+
}
77+
}
78+
```
79+
80+
### Initializing your BitPay client
81+
82+
Once you have the environment file (JSON previously generated) you can initialize the client in two ways:
83+
84+
```python
85+
from bitpay.client import Client
86+
87+
bitpay = Client(config_file_path)
88+
```
89+
90+
```python
91+
from bitpay.client import Client
92+
93+
bitpay = Client(None, environment, private_key_path, tokens)
94+
```
95+
96+
### Pair your client with BitPay
97+
98+
Your client must be paired with the BitPay server. The pairing initializes authentication and authorization for your client to communicate with BitPay for your specific merchant account.
99+
100+
Pairing is accomplished by running the bitpay [python Setup]((setup/bitpay_setup.py)) utility request a pairing code from the BitPay server.
101+
Meanwhile a new pairing code is generated, the python Setup utility will ask you to activate it in your BitPay account. It will also store the paired token in the environment file.
102+
103+
The pairing code is then entered into the BitPay merchant dashboard for the desired merchant. Your interactive authentication at https://bitpay.com/login provides the authentication needed to create finalize the client-server pairing request.
104+
105+
## Copyright
106+
Copyright (c) 2019 BitPay
107+
108+
See also the tests project for more examples of API calls.

0 commit comments

Comments
 (0)