Skip to content

Commit 633dcdb

Browse files
authored
Merge pull request #14 from marcinx/master
* update README
2 parents 290531e + b12995b commit 633dcdb

File tree

4 files changed

+55
-73
lines changed

4 files changed

+55
-73
lines changed

README.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Upon visiting the URL, your customer is presented with a checkout page hosted on
7373
let response = await client.post('/checkout/hosted', {
7474
charge:{
7575
customerId: customerId, // associates this charge with a customer
76-
currency: 'USD', // specifies the billing currency
76+
billingCurrency: 'USD', // specifies the billing currency
7777
lineItems: [{ // a list of line items included in this charge
7878
description: 'T-Shirt',
7979
netAmount: 10,
@@ -93,7 +93,7 @@ let response = await client.post('/checkout/hosted', {
9393
percent: 0.0825 // 8.25% CA sales tax
9494
}]
9595
},
96-
settlementCurrency: 'EUR' // specifies in which currency you want to settle
96+
settlementAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN' // your settlement asset as given by GET /assets (or ORIGIN to omit conversion)
9797
});
9898

9999
console.log(response.status);
@@ -123,7 +123,7 @@ console.log(response.data);
123123

124124
if (response.status === 200) {
125125
let state = response.data['checkout']['state'];
126-
if (['COMPLETED'].includes(state)) {
126+
if (state === 'CHECKOUT_COMPLETED') {
127127
console.log("The payment has completed and your account was credited. You can now ship the goods.");
128128
} else {
129129
// try again in 30 seconds or so...
@@ -147,28 +147,12 @@ console.log(response.status);
147147
console.log(response.data);
148148
```
149149

150-
**Withdraw to your NGN Bank Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
151-
```javascript
152-
let response = await client.post('/withdrawal', {
153-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
154-
sourceAmount: 100,
155-
targetNetwork: 'NGN', // send to an NGN bank account
156-
targetAccount: {
157-
nuban: '3080494548',
158-
bankName: 'FirstBank'
159-
}
160-
});
161-
162-
console.log(response.status);
163-
console.log(response.data);
164-
```
165-
166150
**Withdraw to your Bitcoin Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
167151
```javascript
168152
let response = await client.post('/withdrawal', {
169-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
153+
sourceAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
170154
sourceAmount: 100,
171-
targetNetwork: 'BTC', // send to a BTC address
155+
targetNetwork: 'BITCOIN', // a target network as given by GET /networks
172156
targetAccount: {
173157
address: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23'
174158
}
@@ -178,15 +162,15 @@ console.log(response.status);
178162
console.log(response.data);
179163
```
180164

181-
**Withdraw to your Stellar Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
165+
**Withdraw USDC to your Stellar Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
182166
```javascript
183167
let response = await client.post('/withdrawal', {
184-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
168+
sourceAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
185169
sourceAmount: 100,
186-
targetNetwork: 'XLM', // send to a Stellar account
170+
targetNetwork: 'STELLAR', // a target network as given by GET /networks
187171
targetAccount: {
188172
account: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23',
189-
memo: 'Exodus',
173+
memo: 'Transfer Note',
190174
memoType: 'text'
191175
}
192176
});
@@ -219,9 +203,16 @@ console.log(response.status);
219203
console.log(response.data);
220204
```
221205

206+
**List all available assets** (https://www.coinqvest.com/en/api-docs#get-assets)
207+
```javascript
208+
let response = await client.get('/assets');
209+
210+
console.log(response.status);
211+
console.log(response.data);
212+
222213
**List all available networks** (https://www.coinqvest.com/en/api-docs#get-networks)
223214
```javascript
224-
let response = await client.get('/blockchains');
215+
let response = await client.get('/networks');
225216
226217
console.log(response.status);
227218
console.log(response.data);

src/README.md

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ let customerId = response.data['customerId']; // store this persistently in your
6363

6464
**Create a Hosted Checkout** (https://www.coinqvest.com/en/api-docs#post-checkout-hosted)
6565

66-
Hosted checkouts are the simplest form of getting paid using the COINQVEST platform.
66+
Hosted checkouts are the simplest form of getting paid using the COINQVEST platform.
6767

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

7070
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.
7171

7272
```javascript
7373
let response = await client.post('/checkout/hosted', {
7474
charge:{
7575
customerId: customerId, // associates this charge with a customer
76-
currency: 'USD', // specifies the billing currency
76+
billingCurrency: 'USD', // specifies the billing currency
7777
lineItems: [{ // a list of line items included in this charge
7878
description: 'T-Shirt',
7979
netAmount: 10,
@@ -93,7 +93,7 @@ let response = await client.post('/checkout/hosted', {
9393
percent: 0.0825 // 8.25% CA sales tax
9494
}]
9595
},
96-
settlementCurrency: 'EUR' // specifies in which currency you want to settle
96+
settlementAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN' // your settlement asset as given by GET /assets (or ORIGIN to omit conversion)
9797
});
9898

9999
console.log(response.status);
@@ -123,7 +123,7 @@ console.log(response.data);
123123

124124
if (response.status === 200) {
125125
let state = response.data['checkout']['state'];
126-
if (['COMPLETED'].includes(state)) {
126+
if (state === 'CHECKOUT_COMPLETED') {
127127
console.log("The payment has completed and your account was credited. You can now ship the goods.");
128128
} else {
129129
// try again in 30 seconds or so...
@@ -147,28 +147,12 @@ console.log(response.status);
147147
console.log(response.data);
148148
```
149149

150-
**Withdraw to your NGN Bank Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
151-
```javascript
152-
let response = await client.post('/withdrawal', {
153-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
154-
sourceAmount: 100,
155-
targetNetwork: 'NGN', // send to an NGN bank account
156-
targetAccount: {
157-
nuban: '3080494548',
158-
bankName: 'FirstBank'
159-
}
160-
});
161-
162-
console.log(response.status);
163-
console.log(response.data);
164-
```
165-
166150
**Withdraw to your Bitcoin Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
167151
```javascript
168152
let response = await client.post('/withdrawal', {
169-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
153+
sourceAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
170154
sourceAmount: 100,
171-
targetNetwork: 'BTC', // send to a BTC address
155+
targetNetwork: 'BITCOIN', // a target network as given by GET /networks
172156
targetAccount: {
173157
address: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23'
174158
}
@@ -178,15 +162,15 @@ console.log(response.status);
178162
console.log(response.data);
179163
```
180164

181-
**Withdraw to your Stellar Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
165+
**Withdraw USDC to your Stellar Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
182166
```javascript
183167
let response = await client.post('/withdrawal', {
184-
sourceAsset: 'USD:GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', // withdraw from your USD wallet
168+
sourceAsset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USD wallet
185169
sourceAmount: 100,
186-
targetNetwork: 'XLM', // send to a Stellar account
170+
targetNetwork: 'STELLAR', // a target network as given by GET /networks
187171
targetAccount: {
188172
account: 'bc1qj633nx575jm28smgcp3mx6n3gh0zg6ndr0ew23',
189-
memo: 'Exodus',
173+
memo: 'Transfer Note',
190174
memoType: 'text'
191175
}
192176
});
@@ -219,37 +203,44 @@ console.log(response.status);
219203
console.log(response.data);
220204
```
221205

206+
**List all available assets** (https://www.coinqvest.com/en/api-docs#get-assets)
207+
```javascript
208+
let response = await client.get('/assets');
209+
210+
console.log(response.status);
211+
console.log(response.data);
212+
222213
**List all available networks** (https://www.coinqvest.com/en/api-docs#get-networks)
223214
```javascript
224-
let response = await client.get('/blockchains');
215+
let response = await client.get('/networks');
225216
226217
console.log(response.status);
227218
console.log(response.data);
228219
```
229220

230-
**The response object** ([axios](https://github.com/axios/axios) HTTP response as given to your callback function)
221+
**The response object** ([axios](https://github.com/axios/axios) HTTP response as given to your callback function)
231222
```javascript
232223
{
233-
// `data` is the response that was provided by the server
234-
data: {},
224+
// `data` is the response that was provided by the server
225+
data: {},
235226
236-
// `status` is the HTTP status code from the server response
237-
status: 200,
227+
// `status` is the HTTP status code from the server response
228+
status: 200,
238229
239-
// `statusText` is the HTTP status message from the server response
240-
statusText: 'OK',
230+
// `statusText` is the HTTP status message from the server response
231+
statusText: 'OK',
241232
242-
// `headers` the HTTP headers that the server responded with
243-
// All header names are lower cased and can be accessed using the bracket notation.
244-
// Example: `response.headers['content-type']`
245-
headers: {},
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: {},
246237
247-
// `config` is the config that was provided to `axios` for the request
248-
config: {},
238+
// `config` is the config that was provided to `axios` for the request
239+
config: {},
249240
250-
// `request` is the request that generated this response
251-
// The last ClientRequest instance in node.js (in redirects)
252-
request: {}
241+
// `request` is the request that generated this response
242+
// The last ClientRequest instance in node.js (in redirects)
243+
request: {}
253244
}
254245
```
255246

src/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function Client(key, secret) {
2020
this.secret = secret;
2121

2222
// @string The current version of this SDK, used in the HTTP user agent (leave it as is)
23-
this.clientVersion = '0.0.6'; // good way to pull this from package.json instead?
23+
this.clientVersion = '0.0.7'; // good way to pull this from package.json instead?
2424

2525
// @string Used in the HTTP user agent (leave it as is)
2626
this.clientName = 'nodejs-merchant-sdk';

src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"author": "COINQVEST Ltd.",
2+
"author": "COINQVEST LLC",
33
"name": "coinqvest-merchant-sdk",
44
"description": "Official COINQVEST Merchant API SDK for NodeJS by www.coinqvest.com",
5-
"version": "0.0.6",
5+
"version": "0.0.7",
66
"main": "./lib/index.js",
77
"keywords": [
88
"payment-gateway",

0 commit comments

Comments
 (0)