Workflow

Note

— You must setup Node.JS & Block.Io before proceeding. See – https://docs.paymoney.techvill.net/setup-nodejs-blockio/

— CryptoCurrencies will only work on Pay Money v2.7.

— If the merchant/admin uses TESTNET! CryptoCurrencies, he/she will be able to use only 10 Wallet Addresses per Network/CryptoCurrency.

— Hence, The “Waddler Plan” has been recommended by Block.Io (see – https://block.io/pricing)

If the node WebSocket server is not kept running, Pay Money won’t be able to monitor cryptocurrency transactions.

What is possible via CryptoCurrencies?

— Cryptocurrency can be sent between user valid network wallet addresses

— Cryptocurrency can be sent from user to merchant valid network wallet address

— Cryptocurrency can be sent from user to any valid network wallet address 

Cryptocurrency can be sent both via Pay Money and Block.io but to valid network wallet addresses

Prerequisites

SSH access

Node.JS (installed)

Block.io Account (merchant/admin account, with balance)

If you don’t have above prerequisites, please see https://docs.paymoney.techvill.net/node-blockio-setup/

If you have above prerequisites, the working process is described below:-

BACKEND:-

1) Log in to your account using SSH.

2) Go to your domain/sub-domain where Pay Money v2.7 project files exist.

3) Run the following commands:

npm install --save block_io dotenv moment mysql ws

The above command will install Block.Io, Dotenv, Moment, MySQL and WebSocket node_modules in your pay money project.

You can check them at package.json to verify.

4) Now, you need to install forever node module to keep a Block.io WebSocket running in your Pay Money project.

Run the following command via SSH.

npm install forever -g

These will be needed later for executing the node WebSocket server. 

The WebSocket server will subscribe to all merchant/admin account’s address balance changes and their updates while staying connected to a Block.io Notifications server

(see – https://block.io/docs/notifications)

4) Now that the node modules are installed, go to admin->settings->preferences and select “Fiat & Crypto” from Enabled Currencies dropdown.

 

5) Go to “CryptoCurrencies Settings” and enter API Key, PIN, Merchant/Admin Address of each Network/CryptoCurrency of your Block.Io account.

 

Some important points to note:

a) The merchant/admin can either set Real or (TESTNET!) credentials.

b) The merchant/admin must enter the valid API key and valid address of each network/cryptocurrency.

c) Only “Active” cryptocurrencies will be considered.

d) Every time the merchant/admin changes cryptocurrency settings credentials(e.g. API Key), existing cryptocurrencies might be dysfunctional and WebSocket must be restarted!

Hence, it is not recommended to do so.

6) The merchant/admin can now add cryptocurrencies.

Go to “currencies->Add Currency” and select “Crypto” Type. You will see cryptocurrencies (that you have made active in the cryptocurrencies setting).

Some important points to note:

a) The merchant/admin cannot add the same cryptocurrency twice.

b) CryptoCurrency status name, symbol, status cannot be changed.

c) When the merchant/admin updates the status of “cryptocurrency settings”, it reflects on the cryptocurrency status too.

d) If “Create Address” is set to “On”, wallet address against selected cryptocurrency will be created for all “ACTIVE” existing/registered users. These user wallet addresses will be created under the cryptocurrency of the merchant/admin.

7) Now, go to settings->general and select cryptocurrencies from the “Allowed Crypto Currencies” option. Based on this setting, whenever a user registers or admin creates a user, a unique wallet address will be generated for that user.

Note:  The “Waddler Plan” has been recommended by Block.Io (see – https://block.io/pricing). If the merchant/admin uses TESTNET! CryptoCurrencies, only 10 users will be able to get wallet Addresses per Network/CryptoCurrency.

Now, the configurations of cryptocurrencies on the admin panel are done, the system administrator can start the node block.io WebSocket server to monitor/subscribe to all users’ as well his/her own account’s address balance changes.

 Login to your account using SSH.

 Go to your domain/sub-domain where Pay Money v2.7 project files exist.

Run the following command to check all address balance changes:

forever start blockio/websocket.js

Note:

1) The Forever node module will keep the Block.io WebSocket server keep running in the background.

2) You can check the process is running or not by running the command “forever list”.

3) Even if you exit the SSH, the Block.io WebSocket server will keep running in the background.

FRONTEND:-

— After a user registers successfully, a wallet address is generated for him/her and he/she can “Send” and “Receive” cryptocurrencies from the user dashboard.

Crypto Receive

— A QR code will be generated against the unique cryptocurrency wallet address of the user.

— The user can present his/her wallet address to other users or any valid cryptocurrency (here, DOGETEST) wallet address for receiving cryptocurrency.

Crypto Send

a) The merchant/admin can see the transaction on his/her account.

b) The node WebSocket server will receive responses from Block.io after 1 confirmation.

c) Generally, the node WebSocket server will receive responses from Block.io after –

 — 1, 10 confirmations (DOGE/DOGETEST).

 — 1, 3 confirmations (BITCOIN/BITCOINTEST).

 — 1, 5 confirmations (LITECOIN/LITECOINTEST).

d) After 1 confirmation, crypto transactions are saved to Pay Money.

Note: The status of crypto transactions (both Crypto Sent & Crypto Received) will both be ‘Pending’ after 1 confirmation.

e) After greater than 1 confirmation, the confirmations of crypto transactions (both Crypto Sent & Crypto Received) will be “Success”.

 

 

The merchant/admin can also send/receive cryptocurrencies from/to a user.

 

Admin/Merchant Crypto Send


Admin/Merchant Crypto Receive

CryptoCurrencies Transactions

The node WebSocket monitoring continues until and unless the system administration exits it or updates the cryptocurrency settings without restarting it.

If the node WebSocket server is not kept running, Pay Money won’t be able to monitor cryptocurrency transactions.

REFERENCES:-

https://block.io

Categories

© Copyright, Techvillage