Skip to content

bitcoin-express/merchantGateway

Repository files navigation

API

This Merchant Wallet API example runs in the merchant's own server environment with optional authentication by means of using the config.json file. It stores coins, creates/stores payment requests and provides a service to retrieve the balance and redeem saved coins to a Bitcoin address. It MUST be private and NOT PUBLIC (accessible from Internet).

Open endpoints

The following endpoints does not require authentication.

HTTP Method URL Description
POST /payment Proceed with the payment by checking the validity of the coins, storing them and returning the payment result.
POST /register Create a new merchant account

Endpoints that require Authentication

Closed endpoints require the valid authentication string included in the body request. It will be valid if the string is the same as the authentication value from the config.json file.

HTTP Method URL Description
POST /createPaymentRequest Creates and stores in DB a new paymentRequest, and returns the paymentRequest
GET /getBalance Retrieves the sum of the coin values from the wallet
POST /getCoins Extract desired amount of Coins in the standard Bitcoin-express file format
GET /getPaymentStatus Retrieves a specific location object by payment_id or merchant_data
GET /getTransactions Retrieves the whole list of transactions from the DB
POST /redeem Sends funds from the wallet to a Bitcoin address
POST /setConfig Update settings configuration values

Installation

Example of the instructions for Linux systems. For the rest of OS please follow the provided links.

Requirements

  • Already installed nodejs and npm in the server.
  • Secure certificate and key located at sslcert folder to allow HTTPS access to the server. More information at the sslcert folder.

Steps

1. Install dependencies

npm install

2. Install MongoDB

For other OS - MacOS, Windows, etc. More instructions here.

sudo apt-get install -y mongodb mongo

3. Connect to DB

From the terminal, open mongodb shell:

mongo bitcoin-express

After you are connected, you can display the list of payments and retrieve the coins in the shell ('payments' table must be in the list):

show collections

Display all the payments recorded:

db.payments.find()

Display all the coins collected from payments:

db.payments.find({}, {"coins": 1})

4. Run the server API

node app.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published