You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
4
5
-
This SDK implements BitPay's remote client authentication and authorization strategy. No private or shared-secret information is ever transmitted over the wire.
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
6
7
7
### Dependencies
8
8
@@ -15,126 +15,113 @@ If you need testnet bitcoin please visit a testnet faucet, e.g. https://testnet.
15
15
16
16
For more information about testing, please see https://bitpay.com/docs/testing
17
17
18
+
### Handling your client private key
18
19
19
-
### Usage
20
+
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.
20
21
21
-
This library was built and tested using the Eclipse IDE; the source code tree is directly compatible with Eclipse.
22
-
Library dependencies can be downloaded by executing the following command at the root of the library:
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.
27
23
28
-
### Handling your client private key
24
+
On a Windows machine:
29
25
30
-
Each client paired with the BitPay server requires a public and private key. This 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.
26
+
The [BitPay.Net Setup utility](https://github.com/bitpay/csharp-bitpay-client/releases/download/v2.0.1904/BitPay.Net_Setup_utility.zip) helps to generate the private key, as well as a environment file formatted in JSON 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.
31
27
32
-
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.
28
+
Follow the guide [BitPay.Net Setup utility guide](https://github.com/bitpay/csharp-bitpay-client/blob/master/BitPaySetup/README.md)that assist you to create the environment file which you will be able to modify it, either manually or by using the BitPay.Net Setup utility, later on by asking you to provide the path to your existing JSON file.
33
29
34
-
This SDK provides the capability of internally storing the private key on the client local file system. If the local file system is secure then this is a good option. It is also possible to generate the key yourself (using the SDK) and store the key as required. It is not recommended to transmit the private key over any public or unsecured networks.
30
+
The environment file can be either generated by the BitPay.Net Setup utility or created manually by copying the following Json structure:
35
31
36
-
```java
37
-
// Let the SDK store the private key on the clients local file system.
38
-
BitPay bitpay =newBitPay();
32
+
```json
33
+
{
34
+
"BitPayConfiguration": {
35
+
"Environment": "",
36
+
"EnvConfig": {
37
+
"Test": {
38
+
"PrivateKeyPath": "",
39
+
"ApiTokens": {
40
+
"pos": "",
41
+
"merchant": "",
42
+
"payroll": ""
43
+
}
44
+
},
45
+
"Prod": {
46
+
"PrivateKeyPath": "",
47
+
"ApiTokens": {
48
+
"pos": "",
49
+
"merchant": "",
50
+
"payroll": ""
51
+
}
52
+
}
53
+
}
54
+
}
55
+
}
39
56
```
40
57
41
-
```java
42
-
// Create the private key using the SDK, store it as required, and inject the private key into the SDK.
43
-
ECKey key =KeyUtils.createEcKey();
44
-
this.bitpay =newBitPay(key);
45
-
```
46
58
47
-
```java
48
-
// Create the private key external to the SDK, store it in a file, and inject the private key into the SDK.
This library was built and tested using the Intellij IDE; the source code tree is directly compatible with Other Java IDEs.
62
+
Library dependencies can be downloaded by executing the following command at the root of the library:
55
63
56
-
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. There are two pairing modes available; client initiated and server initiated.
64
+
You can also look ar the full JavaDoc for reference [here](http://htmlpreview.github.io/?https://github.com/bitpay/java-bitpay-client/blob/master/doc/index.html)
57
65
58
-
#### Client initiated pairing
66
+
###Initializing your BitPay client
59
67
60
-
Pairing is accomplished by having your client request a pairing code from the BitPay server. 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.
68
+
Once you have the environment file (JSON previously generated) you can initialize the client on two different ways:
61
69
62
-
```java
63
-
String clientName ="server 1";
64
-
BitPay bitpay =newBitPay(clientName);
65
-
66
-
if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS))
Pairing is accomplished by obtaining a pairing code from the BitPay server. The pairing code is then injected into your client (typically during client initialization/configuration). Your interactive authentication at https://bitpay.com/login provides the authentication needed to create finalize the client-server pairing request.
90
+
### Pair your client with BitPay
80
91
81
-
```java
82
-
// Obtain a pairingCode from your BitPay account administrator.
83
-
String pairingCode ="xxxxxxx";
84
-
String clientName ="server 1";
85
-
BitPay bitpay =newBitPay(clientName);
92
+
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.
86
93
87
-
// Is this client already authorized to use the POS facade?
88
-
if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS))
89
-
{
90
-
// Get POS facade authorization.
91
-
bitpay.authorizeClient(pairingCode);
92
-
}
93
-
```
94
+
Pairing is accomplished by having the BitPay.Net Setup utility request a pairing code from the BitPay server.
95
+
Meanwhile a new pairing code is generated, the BitPay.Net Setup utility will ask you to activate it in your BitPay account. It will also store the paired token in the environment file.
96
+
97
+
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.
This is the Java client library for the BitPay Payment Gateway. This library implements BitPay's [Cryptographically Secure RESTful API](https://bitpay.com/api).
0 commit comments