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
@@ -35,231 +35,199 @@ Get your API key and secret here: https://www.coinqvest.com/en/api-settings
35
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.
36
36
37
37
```javascript
38
-
client.post('/customer',
39
-
{
40
-
customer:{
41
-
email:'john@doe.com',
42
-
firstname:'John',
43
-
lastname:'Doe',
44
-
company:'ACME Inc.',
45
-
adr1:'810 Beach St',
46
-
adr2:'Finance Department',
47
-
zip:'CA 94133',
48
-
city:'San Francisco',
49
-
countrycode:'US'
50
-
}
51
-
},
52
-
function (response) {
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
+
});
53
51
54
-
console.log(response.status);
55
-
console.log(response.data);
52
+
console.log(response.status);
53
+
console.log(response.data);
56
54
57
-
if (response.status!==200) {
58
-
// something went wrong, let's abort and debug by looking at our log file
59
-
console.log('Could not create customer. Inspect above log entry.');
60
-
return;
61
-
}
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
+
}
62
60
63
-
let customerId =response.data['customerId']; // store this persistently in your database
64
-
}
65
-
);
61
+
let customerId =response.data['customerId']; // store this persistently in your database
66
62
```
67
63
68
64
**Create a Hosted Checkout** (https://www.coinqvest.com/en/api-docs#post-checkout-hosted)
69
65
70
-
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.
71
67
72
-
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.
73
69
74
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.
75
71
76
72
```javascript
77
-
client.post('/checkout/hosted',
78
-
{
79
-
charge:{
80
-
customerId: customerId, // associates this charge with a customer as crated by POST /customer
81
-
billingCurrency:'USD', // a billing currency as given by GET /currencies
82
-
lineItems: [{ // a list of line items included in this charge
83
-
description:'T-Shirt',
84
-
netAmount:10,
85
-
quantity:1
86
-
}],
87
-
discountItems: [{ // an optional list of discounts
88
-
description:'Loyalty Discount',
89
-
netAmount:0.5
90
-
}],
91
-
shippingCostItems: [{ // an optional list of shipping and handling costs
92
-
description:'Shipping and Handling',
93
-
netAmount:3.99,
94
-
taxable:false// sometimes shipping costs are taxable
95
-
}],
96
-
taxItems: [{
97
-
name:'CA Sales Tax',
98
-
percent:0.0825// 8.25% CA sales tax
99
-
}]
100
-
},
101
-
settlementAsset:'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'// your settlement asset as given by GET /assets (or ORIGIN to omit conversion)
73
+
let response =awaitclient.post('/checkout/hosted', {
74
+
charge:{
75
+
customerId: customerId, // associates this charge with a customer
76
+
currency:'USD', // specifies the billing currency
77
+
lineItems: [{ // a list of line items included in this charge
78
+
description:'T-Shirt',
79
+
netAmount:10,
80
+
quantity:1
81
+
}],
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
+
}]
102
95
},
103
-
function (response) {
104
-
105
-
console.log(response.status);
106
-
console.log(response.data);
96
+
settlementCurrency:'EUR'// specifies in which currency you want to settle
97
+
});
107
98
108
-
if (response.status!==200) {
109
-
// something went wrong, let's abort and debug by looking at our log file
110
-
console.log('Could not create checkout.');
111
-
return;
112
-
}
99
+
console.log(response.status);
100
+
console.log(response.data);
113
101
114
-
// the checkout was created
115
-
// response.data now contains an object as specified in the success response here: https://www.coinqvest.com/en/api-docs#post-checkout
116
-
let checkoutId =response.data['checkoutId']; // store this persistently in your database
117
-
let url =response.data['url']; // redirect your customer to this URL to complete the payment
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
+
}
118
107
119
-
}
120
-
);
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:
126
117
127
118
```javascript
128
-
client.get('/checkout',
129
-
{id: checkoutId},
130
-
function(response) {
131
-
console.log(response.status);
132
-
console.log(response.data);
133
-
134
-
if (response.status===200) {
135
-
let state =response.data['checkout']['state'];
136
-
if (state ==='COMPLETED') {
137
-
console.log("The payment has completed and your account was credited. You can now ship the goods.");
138
-
} else {
139
-
// try again in 30 seconds or so...
140
-
}
141
-
}
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 (['COMPLETED'].includes(state)) {
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...
142
130
}
143
-
);
131
+
}
144
132
```
145
133
146
134
**Query your USD Wallet** (https://www.coinqvest.com/en/api-docs#get-wallet)
147
135
```javascript
148
-
client.get('/wallet',
149
-
{assetCode:'USD'},
150
-
function(response) {
151
-
console.log(response.status);
152
-
console.log(response.data);
153
-
}
154
-
);
136
+
let response =awaitclient.get('/wallet', {assetCode:'USD'});
137
+
138
+
console.log(response.status);
139
+
console.log(response.data);
155
140
```
156
141
157
142
**Query all Wallets** (https://www.coinqvest.com/en/api-docs#get-wallets)
158
143
```javascript
159
-
client.get('/wallets',
160
-
null,
161
-
function(response) {
162
-
console.log(response.status);
163
-
console.log(response.data);
144
+
let response =awaitclient.get('/wallets');
145
+
146
+
console.log(response.status);
147
+
console.log(response.data);
148
+
```
149
+
150
+
**Withdraw to your NGN Bank Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
151
+
```javascript
152
+
let response =awaitclient.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'
164
159
}
165
-
);
160
+
});
161
+
162
+
console.log(response.status);
163
+
console.log(response.data);
166
164
```
167
165
168
-
**Withdraw USDC to your Bitcoin Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
166
+
**Withdraw to your Bitcoin Account** (https://www.coinqvest.com/en/api-docs#post-withdrawal)
169
167
```javascript
170
-
client.post('/withdrawal',
171
-
{
172
-
sourceAsset:'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // withdraw from your USDC wallet
173
-
sourceAmount:100,
174
-
targetNetwork:'BITCOIN', // a target network as given by GET /networks
let response =awaitclient.put('/customer', {customer:{id:'CUSTOMER-ID', email:'john@doe-2.com'}});
201
+
202
+
console.log(response.status);
203
+
console.log(response.data);
215
204
```
216
205
217
206
**Delete a Customer** (https://www.coinqvest.com/en/api-docs#delete-customer)
218
207
```javascript
219
-
client.delete('/customer',
220
-
{id:'CUSTOMER-ID'},
221
-
function (response) {
222
-
console.log(response.status);
223
-
console.log(response.data);
224
-
}
225
-
);
208
+
let response =awaitclient.delete('/customer', {id:'CUSTOMER-ID'});
209
+
210
+
console.log(response.status);
211
+
console.log(response.data);
226
212
```
227
213
228
214
**List your 250 newest customers** (https://www.coinqvest.com/en/api-docs#get-customers)
229
215
```javascript
230
-
client.get('/wallet',
231
-
{limit:250},
232
-
function(response) {
233
-
console.log(response.status);
234
-
console.log(response.data);
235
-
}
236
-
);
237
-
```
216
+
let response =awaitclient.get('/wallet', {limit:250});
238
217
239
-
**List all available assets** (https://www.coinqvest.com/en/api-docs#get-assets)
240
-
```javascript
241
-
client.get('/assets',
242
-
null,
243
-
function(response) {
244
-
console.log(response.status);
245
-
console.log(response.data);
246
-
}
247
-
);
218
+
console.log(response.status);
219
+
console.log(response.data);
248
220
```
249
221
250
222
**List all available networks** (https://www.coinqvest.com/en/api-docs#get-networks)
251
223
```javascript
252
-
client.get(
253
-
'/networks',
254
-
null,
255
-
function(response) {
256
-
console.log(response.status);
257
-
console.log(response.data);
258
-
}
259
-
);
224
+
let response =awaitclient.get('/blockchains');
225
+
226
+
console.log(response.status);
227
+
console.log(response.data);
260
228
```
261
229
262
-
**The response object** ([axios](https://github.com/axios/axios) HTTP response as given to your callback function)
230
+
**The response object** ([axios](https://github.com/axios/axios) HTTP response as given to your callback function)
263
231
```javascript
264
232
{
265
233
// `data` is the response that was provided by the server
@@ -285,11 +253,11 @@ client.get(
285
253
}
286
254
```
287
255
288
-
Please inspect https://www.coinqvest.com/en/api-docs for detailed API documentation or email us at service@coinqvest.com if you have questions.
256
+
Please inspect https://www.coinqvest.com/en/api-docs for detailed API documentation or send us an email to service@coinqvest.com.
289
257
290
258
Support and Feedback
291
259
--------------------
292
-
We'd love to hear your feedback. If you have specific problems or bugs with this SDK, please file an issue on GitHub. For general feedback and support requests please email service@coinqvest.com.
260
+
Your feedback is appreciated! If you have specific problems or bugs with this SDK, please file an issue on Github. For general feedback and support requests, send an email toservice@coinqvest.com.
0 commit comments