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
Official COINQVEST Merchant API SDK for NodeJS by www.coinqvest.com
3
+
Official COINQVEST Payments API SDK for NodeJS by www.coinqvest.com
4
+
5
+
Accepting cryptocurrency payments using the COINQVEST API is fast, secure, and easy. After you've signed up and obtained your [API key](https://www.coinqvest.com/en/api-settings), all you need to do is create a checkout or blockchain deposit address on Bitcoin, Lightning, Litecoin, Stellar, or other supported networks to get paid. You can also use he API for fiat on- and off-ramping via SWIFT or SEPA.
4
6
5
7
This SDK implements the REST API documented at https://www.coinqvest.com/en/api-docs
6
8
7
9
For SDKs in different programming languages, see https://www.coinqvest.com/en/api-docs#sdks
8
10
9
-
Read our Merchant API [development guide](https://www.coinqvest.com/en/blog/guide-mastering-cryptocurrency-checkouts-with-coinqvest-merchant-apis-321ac139ce15) and the examples below to help you get started.
10
-
11
11
Requirements
12
12
------------
13
13
* NodeJS >= 10.14.0
@@ -28,221 +28,87 @@ const client = new CoinqvestClient(
28
28
```
29
29
Get your API key and secret here: https://www.coinqvest.com/en/api-settings
30
30
31
-
## Examples
31
+
Guides
32
+
------
32
33
33
-
**Create a Customer** (https://www.coinqvest.com/en/api-docs#post-customer)
34
+
*[Using the COINQVEST API](https://www.coinqvest.com/en/api-docs#getting-started)
*[Authentication](https://www.coinqvest.com/en/api-docs#authentication) (handled by SDK)
37
+
*[Brand Connect](https://www.coinqvest.com/en/api-docs#brand-connect) (white label checkouts on your own domain)
34
38
35
-
Creates a customer object, which can be associated with checkouts, payments, and invoices. Checkouts associated with a customer generate more transaction details, help with your accounting, and can automatically create invoices for your customer and yourself.
39
+
## Wallets and Deposits
36
40
37
-
```javascript
38
-
let response =awaitclient.post('/customer', {
39
-
customer:{
40
-
email:'john@doe.com',
41
-
firstname:'John',
42
-
lastname:'Doe',
43
-
company:'ACME Inc.',
44
-
adr1:'810 Beach St',
45
-
adr2:'Finance Department',
46
-
zip:'CA 94133',
47
-
city:'San Francisco',
48
-
countrycode:'US'
49
-
}
50
-
});
41
+
Your COINQVEST account comes equipped with dedicated deposit addresses for Bitcoin, Lightning, Litecoin, select assets on the Stellar Network, SWIFT, and SEPA, and other supported networks. You can receive blockchain payments within seconds after registering. The [GET /wallets](https://www.coinqvest.com/en/api-docs#get-wallets) and [GET /deposit-address](https://www.coinqvest.com/en/api-docs#deposit-address) endpoints return your blockchain addresses to start receiving custom deposits.
51
42
52
-
console.log(response.status);
53
-
console.log(response.data);
54
-
55
-
if (response.status!==200) {
56
-
// something went wrong, let's abort and debug by looking at our log file
57
-
console.log('Could not create customer. Inspect above log entry.');
58
-
return;
59
-
}
60
-
61
-
let customerId =response.data['customerId']; // store this persistently in your database
43
+
**List Wallets and Deposit Addresses** (https://www.coinqvest.com/en/api-docs#get-wallets)
44
+
```javascript
45
+
let response =awaitclient.get('/wallets');
62
46
```
63
47
64
-
**Create a Hosted Checkout** (https://www.coinqvest.com/en/api-docs#post-checkout-hosted)
65
-
66
-
Hosted checkouts are the simplest form of getting paid using the COINQVEST platform.
67
-
68
-
Using this endpoint, your server submits a set of parameters, such as the payment details including optional tax items, customer information, and settlement currency. Your server then receives a checkout URL in return, which is displayed back to your customer.
48
+
## Checkouts
69
49
70
-
Upon visiting the URL, your customer is presented with a checkout page hosted on COINQVEST servers. This page displays all the information the customer needs to complete payment.
50
+
COINQVEST checkouts provide fast and convenient ways for your customers to complete payment. We built a great user experience with hosted checkouts that can be fully branded. If you're not into payment pages, you can take full control over the entire checkout process using our backend checkout APIs. Click [here](https://www.coinqvest.com/en/api-docs#building-checkouts)to learn more about building checkouts.
71
51
52
+
**Create a Hosted Checkout (Payment Link)** (https://www.coinqvest.com/en/api-docs#post-checkout-hosted)
72
53
```javascript
73
54
let response =awaitclient.post('/checkout/hosted', {
74
55
charge:{
75
-
customerId: customerId, // associates this charge with a customer
76
-
billingCurrency:'USD', // specifies the billing currency
56
+
billingCurrency:'EUR', // specifies the billing currency
77
57
lineItems: [{ // a list of line items included in this charge
78
-
description:'T-Shirt',
79
-
netAmount:10,
58
+
description:'PCI Graphics Card',
59
+
netAmount:169.99,
80
60
quantity:1
81
61
}],
82
-
discountItems: [{ // an optional list of discounts
83
-
description:'Loyalty Discount',
84
-
netAmount:0.5
85
-
}],
86
-
shippingCostItems: [{ // an optional list of shipping and handling costs
87
-
description:'Shipping and Handling',
88
-
netAmount:3.99,
89
-
taxable:false// sometimes shipping costs are taxable
90
-
}],
91
-
taxItems: [{
92
-
name:'CA Sales Tax',
93
-
percent:0.0825// 8.25% CA sales tax
94
-
}]
62
+
shippingCostItems: [], // an optional list of shipping and handling costs
63
+
taxItems: []
95
64
},
96
65
settlementAsset:'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'// your settlement asset as given by GET /assets (or ORIGIN to omit conversion)
97
66
});
98
-
99
-
console.log(response.status);
100
-
console.log(response.data);
101
-
102
-
if (response.status!==200) {
103
-
// something went wrong, let's abort and debug by looking at our log file
104
-
console.log('Could not create checkout.');
105
-
return;
106
-
}
107
-
108
-
// the checkout was created
109
-
// response.data now contains an object as specified in the success response here: https://www.coinqvest.com/en/api-docs#post-checkout
110
-
let checkoutId =response.data['checkoutId']; // store this persistently in your database
111
-
let url =response.data['url']; // redirect your customer to this URL to complete the payment
Once the payment is captured we notify you via email, [webhook](https://www.coinqvest.com/en/api-docs#webhook-concepts). You can also poll [GET /checkout](https://www.coinqvest.com/en/api-docs#get-checkout) for payment status updates:
117
-
118
-
```javascript
119
-
let response =awaitclient.get('/checkout', {id: checkoutId});
120
-
121
-
console.log(response.status);
122
-
console.log(response.data);
123
-
124
-
if (response.status===200) {
125
-
let state =response.data['checkout']['state'];
126
-
if (state ==='CHECKOUT_COMPLETED') {
127
-
console.log("The payment has completed and your account was credited. You can now ship the goods.");
128
-
} else {
129
-
// try again in 30 seconds or so...
130
-
}
131
-
}
132
-
```
133
-
134
-
**Query your USD Wallet** (https://www.coinqvest.com/en/api-docs#get-wallet)
135
-
```javascript
136
-
let response =awaitclient.get('/wallet', {assetCode:'USD'});
137
-
138
-
console.log(response.status);
139
-
console.log(response.data);
140
67
```
141
68
142
-
**Query all Wallets** (https://www.coinqvest.com/en/api-docs#get-wallets)
143
-
```javascript
144
-
let response =awaitclient.get('/wallets');
69
+
## Swaps And Transfers
145
70
146
-
console.log(response.status);
147
-
console.log(response.data);
148
-
```
71
+
Once funds arrive in your account, either via completed checkouts or custom deposits, you have instant access to them and the ability to swap them into other assets or transfer them to your bank account or other blockchain accounts (we recommend to always forward funds into self-custody on cold storage). The [POST /swap](https://www.coinqvest.com/en/api-docs#post-swap) and [POST /transfer](https://www.coinqvest.com/en/api-docs#post-transfer) endpoints will get you started on swaps and transfers.
149
72
150
-
**Withdraw to your Bitcoin Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
73
+
**Swap Bitcoin to USDC** (https://www.coinqvest.com/en/api-docs#post-swap)
151
74
```javascript
152
-
let response =awaitclient.post('/withdrawal', {
153
-
sourceAsset:'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
154
-
sourceAmount:100,
155
-
targetNetwork:'BITCOIN', // a target network as given by GET /networks
targetAccount:'A unique SEPA account label as previously specified in POST /target-account'
176
89
});
177
-
178
-
console.log(response.status);
179
-
console.log(response.data);
180
90
```
181
91
182
-
**Update a Customer** (https://www.coinqvest.com/en/api-docs#put-customer)
183
-
```javascript
184
-
let response =awaitclient.put('/customer', {customer:{id:'CUSTOMER-ID', email:'john@doe-2.com'}});
185
-
186
-
console.log(response.status);
187
-
console.log(response.data);
188
-
```
189
-
190
-
**Delete a Customer** (https://www.coinqvest.com/en/api-docs#delete-customer)
191
-
```javascript
192
-
let response =awaitclient.delete('/customer', {id:'CUSTOMER-ID'});
193
-
194
-
console.log(response.status);
195
-
console.log(response.data);
196
-
```
92
+
## Supported Assets, Currencies, and Networks
197
93
198
-
**List your 250 newest customers** (https://www.coinqvest.com/en/api-docs#get-customers)
94
+
**List all available Networks** (https://www.coinqvest.com/en/api-docs#get-networks)
199
95
```javascript
200
-
let response =awaitclient.get('/wallet', {limit:250});
201
-
202
-
console.log(response.status);
203
-
console.log(response.data);
96
+
let response =awaitclient.get('/networks');
204
97
```
205
98
206
-
**List all available assets** (https://www.coinqvest.com/en/api-docs#get-assets)
99
+
**List all available Assets** (https://www.coinqvest.com/en/api-docs#get-assets)
207
100
```javascript
208
101
let response =awaitclient.get('/assets');
209
-
210
-
console.log(response.status);
211
-
console.log(response.data);
212
-
213
-
**List all available networks** (https://www.coinqvest.com/en/api-docs#get-networks)
214
-
```javascript
215
-
let response = await client.get('/networks');
216
-
217
-
console.log(response.status);
218
-
console.log(response.data);
219
102
```
220
103
221
-
**The response object** ([axios](https://github.com/axios/axios) HTTP response as given to your callback function)
104
+
**List all available Billing Currencies** (https://www.coinqvest.com/en/api-docs#get-currencies)
222
105
```javascript
223
-
{
224
-
// `data` is the response that was provided by the server
225
-
data: {},
226
-
227
-
// `status` is the HTTP status code from the server response
228
-
status: 200,
229
-
230
-
// `statusText` is the HTTP status message from the server response
231
-
statusText: 'OK',
232
-
233
-
// `headers` the HTTP headers that the server responded with
234
-
// All header names are lower cased and can be accessed using the bracket notation.
235
-
// Example: `response.headers['content-type']`
236
-
headers: {},
106
+
let response =awaitclient.get('/currencies');
107
+
```
237
108
238
-
// `config` is the config that was provided to `axios` for the request
239
-
config: {},
109
+
## Financial Reports and Accounting
240
110
241
-
// `request` is the request that generated this response
242
-
// The last ClientRequest instance in node.js (in redirects)
243
-
request: {}
244
-
}
245
-
```
111
+
We don't leave you hanging with an obscure and complicated blockchain payment trail to figure out by yourself. All transactions on COINQVEST are aggregated into the Financial Reports section of your account and can even be associated with counter-parties, such as customers and beneficiaries. We provide CSV reports, charts, and beautiful analytics for all your in-house accounting needs.
246
112
247
113
Please inspect https://www.coinqvest.com/en/api-docs for detailed API documentation or send us an email to service@coinqvest.com.
0 commit comments