Skip to content

Commit 9228452

Browse files
authored
Merge pull request #16 from marcinx/master
Updated README
2 parents afeb005 + 8b541ff commit 9228452

File tree

2 files changed

+45
-307
lines changed

2 files changed

+45
-307
lines changed

README.md

Lines changed: 45 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# COINQVEST Merchant SDK (NodeJS)
1+
# COINQVEST Payments API SDK (NodeJS)
22

3-
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.
46

57
This SDK implements the REST API documented at https://www.coinqvest.com/en/api-docs
68

79
For SDKs in different programming languages, see https://www.coinqvest.com/en/api-docs#sdks
810

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-
1111
Requirements
1212
------------
1313
* NodeJS >= 10.14.0
@@ -28,221 +28,87 @@ const client = new CoinqvestClient(
2828
```
2929
Get your API key and secret here: https://www.coinqvest.com/en/api-settings
3030

31-
## Examples
31+
Guides
32+
------
3233

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)
35+
* [Building Checkouts](https://www.coinqvest.com/en/api-docs#building-checkouts)
36+
* [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)
3438

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
3640

37-
```javascript
38-
let response = await client.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.
5142

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 = await client.get('/wallets');
6246
```
6347

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
6949

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.
7151

52+
**Create a Hosted Checkout (Payment Link)** (https://www.coinqvest.com/en/api-docs#post-checkout-hosted)
7253
```javascript
7354
let response = await client.post('/checkout/hosted', {
7455
charge:{
75-
customerId: customerId, // associates this charge with a customer
76-
billingCurrency: 'USD', // specifies the billing currency
56+
billingCurrency: 'EUR', // specifies the billing currency
7757
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,
8060
quantity: 1
8161
}],
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: []
9564
},
9665
settlementAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN' // your settlement asset as given by GET /assets (or ORIGIN to omit conversion)
9766
});
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
112-
```
113-
114-
**Monitor Payment State** (https://www.coinqvest.com/en/api-docs#get-checkout)
115-
116-
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 = await client.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 = await client.get('/wallet', {assetCode: 'USD'});
137-
138-
console.log(response.status);
139-
console.log(response.data);
14067
```
14168

142-
**Query all Wallets** (https://www.coinqvest.com/en/api-docs#get-wallets)
143-
```javascript
144-
let response = await client.get('/wallets');
69+
## Swaps And Transfers
14570

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.
14972

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)
15174
```javascript
152-
let response = await client.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
156-
targetAccount: {
157-
address: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23'
158-
}
75+
let response = await client.post('/swap', {
76+
sourceAsset: 'BTC:GCQVEST7KIWV3KOSNDDUJKEPZLBFWKM7DUS4TCLW2VNVPCBGTDRVTEIT',
77+
targetAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
78+
targetAmount: 100
15979
});
160-
161-
console.log(response.status);
162-
console.log(response.data);
16380
```
16481

165-
**Withdraw USDC to your Stellar Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
82+
**Transfer USDC to your SEPA Bank** (https://www.coinqvest.com/en/api-docs#post-transfer)
16683
```javascript
167-
let response = await client.post('/withdrawal', {
168-
sourceAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
169-
sourceAmount: 100,
170-
targetNetwork: 'STELLAR', // a target network as given by GET /networks
171-
targetAccount: {
172-
account: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23',
173-
memo: 'Transfer Note',
174-
memoType: 'text'
175-
}
84+
let response = await client.post('/transfer', {
85+
network: 'SEPA',
86+
asset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
87+
amount: 100,
88+
targetAccount: 'A unique SEPA account label as previously specified in POST /target-account'
17689
});
177-
178-
console.log(response.status);
179-
console.log(response.data);
18090
```
18191

182-
**Update a Customer** (https://www.coinqvest.com/en/api-docs#put-customer)
183-
```javascript
184-
let response = await client.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 = await client.delete('/customer', {id: 'CUSTOMER-ID'});
193-
194-
console.log(response.status);
195-
console.log(response.data);
196-
```
92+
## Supported Assets, Currencies, and Networks
19793

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)
19995
```javascript
200-
let response = await client.get('/wallet', {limit: 250});
201-
202-
console.log(response.status);
203-
console.log(response.data);
96+
let response = await client.get('/networks');
20497
```
20598

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)
207100
```javascript
208101
let response = await client.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);
219102
```
220103

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)
222105
```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 = await client.get('/currencies');
107+
```
237108

238-
// `config` is the config that was provided to `axios` for the request
239-
config: {},
109+
## Financial Reports and Accounting
240110

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.
246112

247113
Please inspect https://www.coinqvest.com/en/api-docs for detailed API documentation or send us an email to service@coinqvest.com.
248114

0 commit comments

Comments
 (0)