The Greencryptopay library for Node.js allows you to easily integrate the Greencryptopay payment system into your Node.js projects. This library provides convenient methods for interacting with the Greencryptopay API.
You can install this package using npm:
npm install greencryptopay-nodejs --save
This package depends on the "node-fetch" library version ^2.6. If it's not already installed, it will be automatically installed when you install this library.
Getting Started:
import Api from 'greencryptopay-nodejs';
(async () => {
// Standard API
const standardApi = Api.make('standard');
// Standard API testnet
const standardApi = Api.make('standard', true);
// Sign up
if (!merchantId || !secretKey) {
const data = await standardApi.merchant('percent', 'https://example.com/callback');
merchantId = data['merchant_id'];
secretKey = data['secret_key'];
}
standardApi.setMerchantId(merchantId);
standardApi.setSecretKey(secretKey);
})()
Sign up:
Name | Parameters | Validation | Description |
---|---|---|---|
merchant |
|
|
|
Operations:
Name | Parameters | Validation | Description |
---|---|---|---|
paymentAddress |
|
|
|
withdraw |
|
|
|
withdrawAll |
|
|
|
Stats:
Name | Parameters | Validation | Description |
---|---|---|---|
merchantState |
|
|
|
merchantPaymentAddress |
|
|
|
merchantIncomingPayments |
|
|
|
merchantWithdrawals |
|
|
|
paymentAddressCallbacks |
|
|
|
paymentAddressState |
|
|
|
Getting Started:
import Api from 'greencryptopay-nodejs';
(async () => {
// Transfer API
const transferApi = Api.make('transfer');
// Transfer API testnet
const transferApi = Api.make('transfer', true);
// Sign up
if (!merchantId) {
const data = await transferApi.merchant();
merchantId = data['merchant_id'];
}
transferApi.setMerchantId(merchantId);
})()
Sign up:
Name | Parameters | Validation | Description |
---|---|---|---|
merchant | — | — | — |
Operations:
Name | Parameters | Validation | Description |
---|---|---|---|
paymentAddress |
|
|
|
Stats:
Name | Parameters | Validation | Description |
---|---|---|---|
paymentAddressState |
|
|
|
paymentAddressPayments |
|
|
|
paymentAddressCallbacks |
|
|
|
merchantState |
|
|
|
merchantPaymentAddress |
|
|
|
merchantPayments |
|
|
|