NAV Navigation
CURL Node.JS PHP Go

Forging Block Universal API

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Create demo invoice:

Shows invoice example, non refundable

Supported cryptocurrency:

All examples are provided for the MainNet.

Registration

curl 'https://api.forgingblock.io/register' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce'
var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce';

var options = {
    url: 'https://api.forgingblock.io/register',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce'
);
$response = Requests::post('https://api.forgingblock.io/register', $headers, $data);
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/register", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"You only need to confirm email now"}

POST /register

Register new account

Password requirements:

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /register

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Creating Store

curl 'https://api.forgingblock.io/create-store' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn'
var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn';

var options = {
    url: 'https://api.forgingblock.io/create-store',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'xpub' => 'vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn'
);
$response = Requests::post('https://api.forgingblock.io/create-store', $headers, $data);
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-store", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Example response:

{"trade":"Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp","token":"108977327347814744673750678559203866607310312666213682394904038637537833731647","store":"ExCAYgcTx6PyDimVaCgmJ1VSdEaDoUkhRoTLgnmmqrrc","wallet":true}

POST /create-store

Creating new store

Beside API reply you should also receive email with store details

You could connect wallet at this step, or you could connect it later

To connect your wallet you need to provide Master Public key (xPub) for your wallet.

xPub keys can never be used to access your funds. The xPub does not contain any private key information.

Example for electrum wallet:

You could find xPub in electrum in Wallet->Wallet Information

To use TestNet you need testnet wallet.

You could launch electrum with electrum --testnet to generate testnet wallet.

Beside API reply you should also receive email with store details

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
xpub body [string] false Master Public key (xPub)

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

Response Parameters

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
store body [string] true store id
wallet body [boolean] true is wallet connected to the store

OPTIONS /create-store

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connecting Wallet

Connect BTC Wallet

curl 'https://api.forgingblock.io/connect-wallet' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'

curl 'https://api.forgingblock.io/connect-wallet-btc' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Connect BTC wallet

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
/* Connect BTC wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'xpub' => 'vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet', $headers, $data);
// Connect BTC wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpub5Gqqu8RiML18u93aJLEaEGXxE7CCtjx3Lg84UTYowu86RkDzNCW9nJ5tPp59MvHdmDiD5sSLc3wpR2zqcfjhjarVTqxdHQsZFDFXaaQimPn&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet or POST /connect-wallet-btc

Connect new wallet to the store

To connect your wallet you need to provide Master Public key (xPub) for your wallet.

xPub keys can never be used to access your funds. The xPub does not contain any private key information.

You could find xPub in electrum in Wallet->Wallet Information

You could launch electrum with electrum --testnet to generate testnet wallet.

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
xpub body [string] true Master Public key (xPub)
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet or /connect-wallet-btc

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connect LTC Wallet

curl 'https://api.forgingblock.io/connect-wallet-ltc' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpubd55ruGbQfbahASUtRGdzeUCnKkvVuCgXjnMZGYG3r3cu9kP1LW8ifB48ZN2mDEjmLjhh3CuikintZGGyPEAXpVDJHdLmrAcSYzMehiqrKax&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Connect LTC wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpubd55ruGbQfbahASUtRGdzeUCnKkvVuCgXjnMZGYG3r3cu9kP1LW8ifB48ZN2mDEjmLjhh3CuikintZGGyPEAXpVDJHdLmrAcSYzMehiqrKax&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-ltc',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect LTC wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'xpub' => 'vpubd55ruGbQfbahASUtRGdzeUCnKkvVuCgXjnMZGYG3r3cu9kP1LW8ifB48ZN2mDEjmLjhh3CuikintZGGyPEAXpVDJHdLmrAcSYzMehiqrKax',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-ltc', $headers, $data);
// Connect LTC wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&xpub=vpubd55ruGbQfbahASUtRGdzeUCnKkvVuCgXjnMZGYG3r3cu9kP1LW8ifB48ZN2mDEjmLjhh3CuikintZGGyPEAXpVDJHdLmrAcSYzMehiqrKax&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-ltc", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-ltc

Connect new wallet to the store

To connect your wallet you need to provide Master Public key (xPub) for your wallet.

xPub keys can never be used to access your funds. The xPub does not contain any private key information.

You could find xPub in electrum-ltc in Wallet->Wallet Information

To use TestNet you need testnet wallet.

You could launch electrum with electrum-ltc --testnet to generate testnet wallet.

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
xpub body [string] true Master Public key (xPub)
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-ltc

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connect ETH Wallet

curl 'https://api.forgingblock.io/connect-wallet-eth' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Connect ETH wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-eth',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect ETH wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'address' => '0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-eth', $headers, $data);
// Connect ETH wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-eth", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-eth

Connect new wallet to the store

To connect your wallet you need to provide your wallet address.

You could use any wallet, for example: MyEtherWallet

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-eth

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Ethereum Tokens

curl 'https://api.forgingblock.io/connect-wallet-eth-token' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT'
// Connect USDT Wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-eth-token',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect USDT wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'address' => '0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E',
	'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc',
	'name' => 'USDT'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-eth-token', $headers, $data);
// Connect USDT wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=0x1Cf4E5001AB8D369d2d76B87658eE719f85e2D6E&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-eth-token", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-eth-token

Connect new wallet to the store

To connect your wallet you need to provide your wallet address and Token name

You could use any wallet, for example: MyEtherWallet

Sometimes legacy mew has better token management

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id
name body [string] true token name (DAI, USDT)

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

POST /add-new-eth-token

Request to add new token support

Only users with forgingblock administrator role could confirm request

Parameters

Parameter In Type Required Description
contract body [string] true token contract address
decimals body [string] true token decimals
name body [string] true token name (for ex.: DAI or USDT)

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-eth-token and /add-new-eth-token

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connect TRON Wallet

curl 'https://api.forgingblock.io/connect-wallet-tron' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Connect TRON wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-tron',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect TRON wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'address' => 'TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-tron', $headers, $data);
// Connect TRON wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-tron", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-tron

Connect new wallet to the store

To connect your wallet you need to provide your wallet address.

You could use any wallet, for example: TronLink

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-tron

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

TRON Tokens

curl 'https://api.forgingblock.io/connect-wallet-tron-token' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT'
// Connect USDT Wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-tron-token',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect USDT wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'address' => 'TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw',
	'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc',
	'name' => 'USDT'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-tron-token', $headers, $data);
// Connect USDT wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=TQ5vcDELdXvzXszWXyM97Bq61aVT6qWwUw&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&name=USDT}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-tron-token", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-tron-token

Connect new wallet to the store

To connect your wallet you need to provide your wallet address and Token name

You could use any wallet, for example: TronLink

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id
name body [string] true token name (WIN, USDT, BTT, TWM, TWJ)

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

POST /add-new-tron-token

Request to add new token support

Only users with forgingblock administrator role could confirm request

Parameters

Parameter In Type Required Description
contract body [string] true token contract address
decimals body [string] true token decimals
name body [string] true token name (for ex.: BTT or USDT)

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-tron-token and /add-new-tron-token

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connect Monero Wallet

curl 'https://api.forgingblock.io/connect-wallet-xmr' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=47EmdKL6kPfFGD9E2PK3izHcdGZRwTrALLMBjo2gVXFwX6wsYcvfsEGFrHAwMkB3Wu6jUYjGc2WozMJ1Z1ACcJwkBjdce86&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&viewkey=544abexxxxxe2xxxx390xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// Connect Monero wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=47EmdKL6kPfFGD9E2PK3izHcdGZRwTrALLMBjo2gVXFwX6wsYcvfsEGFrHAwMkB3Wu6jUYjGc2WozMJ1Z1ACcJwkBjdce86&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&viewkey=544abexxxxxe2xxxx390xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-xmr',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect Monero wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
	'address' => '47EmdKL6kPfFGD9E2PK3izHcdGZRwTrALLMBjo2gVXFwX6wsYcvfsEGFrHAwMkB3Wu6jUYjGc2WozMJ1Z1ACcJwkBjdce86',
	'viewkey' => '544abexxxxxe2xxxx390xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-xmr', $headers, $data);
// Connect Monero wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=47EmdKL6kPfFGD9E2PK3izHcdGZRwTrALLMBjo2gVXFwX6wsYcvfsEGFrHAwMkB3Wu6jUYjGc2WozMJ1Z1ACcJwkBjdce86&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc&viewkey=544abexxxxxe2xxxx390xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-xmr", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-xmr

Connect new wallet to the store

To connect your wallet you need to provide your wallet address and secret viewkey (secret viewkey doesn't provides control on funds, but makes transaction details not private, and allows us to get exact amounts from transactions).

You could find your secret viewkey in Monero GUI Wallet in Settings->Show seed & keys

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id
viewkey body [string] true wallet secret viewkey

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-xmr

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Connect XTZ Wallet

curl 'https://api.forgingblock.io/connect-wallet-xtz' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=tz1WtUam6YiTYod57FiqxiCy3hTQ1vRiKbM2&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Connect XTZ wallet

request(options, callback);

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=tz1WtUam6YiTYod57FiqxiCy3hTQ1vRiKbM2&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/connect-wallet-xtz',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Connect XTZ wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'address' => 'tz1WtUam6YiTYod57FiqxiCy3hTQ1vRiKbM2',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/connect-wallet-xtz', $headers, $data);
// Connect XTZ wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&address=tz1WtUam6YiTYod57FiqxiCy3hTQ1vRiKbM2&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/connect-wallet-xtz", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc wallet was succesfully updated"}

POST /connect-wallet-xtz

Connect new wallet to the store

To connect your wallet you need to provide your wallet address.

You could use any wallet, for example: Galleon

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
address body [string] true wallet address
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /connect-wallet-xtz

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Store Management

Lightning Management

curl 'https://api.forgingblock.io/enable-lightning' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'

curl 'https://api.forgingblock.io/disable-lightning' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'

curl 'https://api.forgingblock.io/withdraw-ln' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Force enable lightning for a store

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/enable-lightning',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

// Force disable lightning for a store
request(options, callback);


var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/disable-lightning',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// On-chain withdraw from Forging Block lightning node to the store's wallet

var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/withdraw-ln',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}


/* Force enable lightning for a store */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/enable-lightning', $headers, $data);

/* Force disable lightning for a store */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/disable-lightning', $headers, $data);

/* On-chain withdraw from Forging Block lightning node to the store's wallet */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/withdraw-ln', $headers, $data);


// Force enable lightning for a store

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/enable-lightning", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Force disable lightning for a store

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/disable-lightning", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// On-chain withdraw from Forging Block lightning node to the store's wallet

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/withdraw-ln", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"success":"Lightning support activated"}
{"success":"Lightning support disabled"}
{"txid":"7243757214bcfc0fc3d881d7cfe850270b57ce4f41105dbe25e7efcb3e0814eb","amount":0.00379819}

For a customer is highly recommended to open channel with Forging Block lightning node first. For a merchant, no extra setup needed.

033c6d5d7e5650f00a6e294c56605554af8e81fd048965ac6adedbf599d6e3214d@lightning.forgingblock.io:9735

023851c65a46fc6936a6c99e3a2b1fef63cedfa55977d68011b0398db54fde9397@lightning.forgingblock.io:9736

POST /enable-lightning

Force enable lightning for a store

POST /disable-lightning

Force disable lightning for a store

By default Forging Block lightning node already connected to your store (and no extra setup needed), but you could ether enable or disable lightning support manually.

POST /withdraw-ln

On-chain withdraw from Forging Block lightning node to the store's wallet

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
store body [string] true store id

Response Parameters

For /withdraw-ln

Parameter In Type Required Description
txid body [string] true transaction id
amount body [string] true amount in transaction

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /enable-lightning, /disable-lightning and /withdraw-ln

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

List All Stores & Remove a Store

curl 'https://api.forgingblock.io/stores-list' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce'

curl 'https://api.forgingblock.io/remove-store' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// List All Stores

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce';

var options = {
    url: 'https://api.forgingblock.io/stores-list',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Remove Store
var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/remove-store',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

/* List All Stores */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce'
);
$response = Requests::post('https://api.forgingblock.io/stores-list', $headers, $data);

/* Remove Store */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/remove-store', $headers, $data);

// List All Stores

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/stores-list", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Remove Store

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/remove-store", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response example:

{"stores":[["8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc"],["AB5ncxMzgZHJTQKkgwpxiLMhpzajbx2AZATgBnJynesc"]]}
{"success":"Store 8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc was succesfully removed"}

POST /stores-list

List All Stores ID's

POST /remove-store

Remove a store

Parameters

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /stores-list, /remove-store

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Invoice Management

Every new invoice lifetime is 15 minutes (avoiding volatility fluctuations)

Invoice status could be

Working directly with new invoices

curl 'https://api.forgingblock.io/create-invoice' -H 'Content-Type: application/x-www-form-urlencoded' \ 
--data 'trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&amount=1550&currency=usd'

curl 'https://api.forgingblock.io/check-invoice' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8'

curl 'https://api.forgingblock.io/check-invoice-status' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8'

// Create new invoice

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var options = {
    url: 'https://api.forgingblock.io/create-invoice',
    headers: headers
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Get invoice details

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8';

var options = {
    url: 'https://api.forgingblock.io/check-invoice',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Get invoice status

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8';

var options = {
    url: 'https://api.forgingblock.io/check-invoice-status',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
 /* Create new invoice */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'trade' => '3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg',
    'token' => '27045735428019377312427720305400499206734565713678297173539855010884886478240',
    'amount' => '1550',
    'currency' => 'usd'
);
$response = Requests::post('https://api.forgingblock.io/create-invoice', $headers, $data);


 /* Get invoice details */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'trade' => '3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg',
    'token' => '27045735428019377312427720305400499206734565713678297173539855010884886478240',
    'invoice' => '6174qz7YsYceLU1WSELTA8'
);
$response = Requests::post('https://api.forgingblock.io/check-invoice', $headers, $data);

 /* Get invoice status */
 
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'trade' => '3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg',
    'token' => '27045735428019377312427720305400499206734565713678297173539855010884886478240',
    'invoice' => '6174qz7YsYceLU1WSELTA8'
);
$response = Requests::post('https://api.forgingblock.io/check-invoice-status', $headers, $data);
// Create new invoice

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&amount=1550&currency=usd}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-invoice", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Get invoice details

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/check-invoice", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Get invoice status

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=3s9LBmZb8yvXT5Dyb7rdrVMKmJkLXiknwPQ84TNxPACg&token=27045735428019377312427720305400499206734565713678297173539855010884886478240&invoice=6174qz7YsYceLU1WSELTA8}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/check-invoice-status", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"id":"U8B7S21kdo8mB7TDtqDUDG","amount":1550,"currency":"USD","realAmount":"0.40162157","creation":1552319384000,"expiration":1552320284000,"payUrl":"bitcoin:tb1qufxkm89aybhp600aycm54s5ycdj2pqz9hzxj4l?amount=0.40162157","status":"new","url":"https://api-demo.forgingblock.io/invoice?id=7hqLE4VN5eS5DyhZLzCVby"}

{"id":"U8B7S21kdo8mB7TDtqDUDG","amount":1550,"currency":"USD","realAmount":"0.40162157","creation":1552319384000,"expiration":1552320284000,"payUrl":"bitcoin:tb1qufxkm89aybhp600aycm54s5ycdj2pqz9hzxj4l?amount=0.40162157","status":"new","url":"https://api-demo.forgingblock.io/invoice?id=7hqLE4VN5eS5DyhZLzCVby"}

{"status":"new"}

POST /create-invoice

Create new invoice

POST /check-invoice

Get invoice details

POST /check-invoice-status

Get invoice status

Most common invoice statuses are: new (for a new invoice), confirmed (successful payment), complete (6 confirmation on chain, as for bitcoin) and expired (invoice expired)

In case you need to do request inside a public script you should use GET instead as this would save trade and token from exposure

Parameters

For /create-invoice

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
amount body [string] true amount for the price
currency body [string] true currency code in ISO 4217
link body [string] false url to follow after the payment
notification body [string] false url for IPN request (used by e-commerce software)
order body [string] false uniq order id (equal to the order id in e-commerce software)

For /check-invoice and /check-invoice-status

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
invoice body [string] true invoice id

OPTIONS /create-invoice, /check-invoice, /check-invoice-status

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

IPN Response Example & Explanation

IPN is send in case notification parameter is provided. Main IPN purpose is to send notification to e-commerce software. IPNs are not signed, so it always better to use /check-invoice or /check-invoice-status directly when its possible.

{"id": "U8B7S21kdo8mB7TDtqDUDG", "url": "https://api-demo.forgingblock.io/invoice?id=7hqLE4VN5eS5DyhZLzCVby", "posData": null, "status": "confirmed", "btcPrice": "0.40162157", "btcPaid": "0.40162157", "btcDue": "0.00000000"}

Invoices History

curl 'https://api.forgingblock.io/get-invoices' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce'

curl 'https://api.forgingblock.io/get-ln-invoices' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce'

curl 'https://api.forgingblock.io/get-store-invoices' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'

curl 'https://api.forgingblock.io/get-store-ln-invoices'  -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'

curl 'https://api.forgingblock.io/get-store-all-invoices'  -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
// Get history with all on-chain invoices for a store (change url, and data for lightning)

var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc';

var options = {
    url: 'https://api.forgingblock.io/get-store-invoices',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Get history with all on-chain invoices for a store (change url, and data for lightning)  */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => '8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc'
);
$response = Requests::post('https://api.forgingblock.io/get-store-invoices', $headers, $data);
// Get history with all on-chain invoices for a store (change url, and data for lightning)

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=8z5ncxMzgZ8qTQKkgwpxiLMhpzajbx2AZATgBnJynesc}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/get-store-invoices", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{
    "ReceivedDate": "2019-04-05T14:01:24Z",
    "StoreId": "2U27LEo88LrpeMJiqsfGq5AK9kECgfa5TC2XmUsydRJt",
    "OrderId": null,
    "InvoiceId": "FKSuQreLNBo6RqVjYUVDTb",
    "InvoiceCreatedDate": "2019-04-05T14:01:07Z",
    "InvoiceExpirationDate": "2019-04-05T14:16:07Z",
    "InvoiceMonitoringDate": "2019-04-05T15:16:07Z",
    "PaymentId": "096ad909d0c7611968aafa5484da013846b97557803e82089315786f6234cb0a",
    "Destination": "lntb3978020n1pw2wharpp5p94djzwscas3j692lf2gfksp8prtja2hsqlgyzynz4ux7c35ev9qdzg2pskjepqw3hjqv3sxyuj6vp595cry4p3xgarywf6xvejuvp3xfdzq2z0wfjx2u3qf9zr5gpfcqzysxqzuy8cy587luax4qq0urcdv4llrt93sxrjmgqj5pa5y73efphmr3pj8yfvq53sxwxpezhh3h48c9dxeextryps7vymnx00ptx8zuhlnjr7sq32gg2k",
    "PaymentType": "OffChain",
    "CryptoCode": "BTC",
    "Paid": "0.00397802",
    "NetworkFee": "0.0",
    "ConversionRate": 5027.63776201246,
    "PaidCurrency": "20.000",
    "InvoiceCurrency": "USD",
    "InvoiceDue": 0,
    "InvoicePrice": 20,
    "InvoiceItemCode": null,
    "InvoiceItemDesc": null,
    "InvoiceFullStatus": "complete",
    "InvoiceStatus": "complete",
    "InvoiceExceptionStatus": "",
    "BuyerEmail": null
}
{"invoices":[["9rX3PEE8U1rZuMppqtBarn"],["KLo7ca2xbxswBHuFYBjfsU"],["LNgzR6u1nNkcrVmamJkGWU"],["JPQcwAoAo5cdTgi5xNPGZ4"],["Q4c18wkfwDYBg8nQfpSxyq"],["SE7FuzCdaQfwPbD38mkJsQ"]]}

POST /get-invoices

Get history with all on-chain invoices with complete/paid statuses

POST /get-store-invoices

Get history with all on-chain invoices for a store with complete/paid statuses

POST /get-store-all-invoices

Get all ever created invoices IDs as array

POST /get-ln-invoices

Get history with all lightning (off-chain) invoices with complete/paid statuses

POST /get-store-ln-invoices

Get history with all lightning (off-chain) invoices for a store with complete/paid statuses

Parameters

For /get-invoices, and /get-ln-invoices

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password

For /get-store-invoices and /get-store-ln-invoices

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

Response Parameters

For /get-invoices, /get-store-invoices, /get-ln-invoices and /get-store-ln-invoices

Parameter Description
ReceivedDate payment received date
StoreId store id
OrderId order Id
InvoiceId invoice id
InvoiceCreatedDate date of creation of the invoice
InvoiceExpirationDate date of expiration of the invoice
InvoiceMonitoringDate date when we cease to monitor events of the invoice
PaymentId unique identifier of a payment
Destination the destination address the customer paid to
PaymentType the type of payment (OnChain, Offchain)
CryptoCode currency code of the method of payment (e.g. BTC)
Paid amount of payment in the currency of CryptoCode
NetworkFee network fee paid by the user in this payment
ConvertionRate conversion rate at invoice creation to convert from CryptoCode to InvoiceCurrency
InvoiceCurrency currency of the invoice (e.g. USD)
InvoiceDue amount still due to fully pay the Invoice after this payment (without NetworkFee, denominated in InvoiceCurrency)
InvoicePrice price of the invoice (without Network Fee, in InvoiceCurrency)
InvoiceItemCode item code of the invoice
InvoiceItemDesc item description of the invoice
InvoiceFullStatus status of the invoice (e.g. expired (paidPartial))
InvoiceStatus status of the invoice (e.g. expired)
InvoiceException status of the invoice (e.g. paidPartial)
BuyerEmail customer email

OPTIONS /get-invoices, /get-store-invoices, /get-ln-invoices and /get-store-ln-invoices

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Display/render invoices & Invoices by invoice ID

request(options, callback);

// Get invoice information

var request = require('request');

var options = {
    url: 'https://api.forgingblock.io/i/7hqLE4VN5eS5DyhZLzCVby/LTC/status?invoiceId=7hqLE4VN5eS5DyhZLzCVby&paymentMethodId=BTC&_=1557326366001'
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
/* Get invoice information */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$response = Requests::get('https://api.forgingblock.io/i/7hqLE4VN5eS5DyhZLzCVby/LTC/status?invoiceId=7hqLE4VN5eS5DyhZLzCVby&paymentMethodId=BTC&_=1557326366001', $headers);
// Get invoice information

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "https://api.forgingblock.io/i/7hqLE4VN5eS5DyhZLzCVby/LTC/status?invoiceId=7hqLE4VN5eS5DyhZLzCVby&paymentMethodId=BTC&_=1557326366001", nil)
	if err != nil {
		log.Fatal(err)
	}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"htmlTitle":"Forging Block Invoice","defaultLang":"en","availableCryptos":[{"paymentMethodId":"BTC","cryptoImage":"/imlegacy/bitcoin.svg","link":"/i/LPKS9Yr6PFHaicrB3Hc9qJ/BTC","paymentMethodName":"Bitcoin","isLightning":false,"cryptoCode":"BTC"},{"paymentMethodId":"BTC_LightningLike","cryptoImage":"/imlegacy/bitcoin-lightning.svg","link":"/i/LPKS9Yr6PFHaicrB3Hc9qJ/BTC_LightningLike","paymentMethodName":"Bitcoin (Lightning)","isLightning":true,"cryptoCode":"BTC"},{"paymentMethodId":"LTC","cryptoImage":"/imlegacy/litecoin.svg","link":"/i/LPKS9Yr6PFHaicrB3Hc9qJ/LTC","paymentMethodName":"Litecoin","isLightning":false,"cryptoCode":"LTC"},{"paymentMethodId":"ETH","cryptoImage":"/imlegacy/ethereum.svg","link":"/i/LPKS9Yr6PFHaicrB3Hc9qJ/ETH","paymentMethodName":"Ethereum","isLightning":false,"cryptoCode":"ETH"}],"isModal":false,"isLightning":false,"cryptoCode":"BTC","invoiceId":"LPKS9Yr6PFHaicrB3Hc9qJ","btcAddress":"bc1q255c99a3dtezm0566jq0y4d0zw9pwzaa3asp5p","btcDue":"0.00101854","customerEmail":null,"requiresRefundEmail":false,"expirationSeconds":0,"status":"expired","merchantRefLink":"/","maxTimeSeconds":900,"storeName":null,"timeLeft":"00:00","rate":"$5,890.84 (USD)","orderAmount":"0.00101854","orderAmountFiat":"$6.00 (USD)","invoiceBitcoinUrl":"bitcoin:bc1q255c99a3dtezm0566jq0y4d0zw9pwzaa3asp5p?amount=0.00101854","invoiceBitcoinUrlQR":"bitcoin:bc1q255c99a3dtezm0566jq0y4d0zw9pwzaa3asp5p?amount=0.00101854","txCount":1,"btcPaid":"0.00000000","storeEmail":null,"orderId":null,"networkFee":0,"isMultiCurrency":false,"maxTimeMinutes":15,"paymentType":null,"paymentMethodId":"BTC","paymentMethodName":"Bitcoin","cryptoImage":"/imlegacy/bitcoin.svg","storeId":"4Y2otkewdai44wp23j7pbDwvt22E4a2oUnHJ8KYaGwKp","peerInfo":"033c6d5d7e5650f00a6e294c56605554af8e81fd048965ac6adedbf599d6e3214d@lightning.forgingblock.io:9735","rootPath":"/"}

GET /invoice?id= + Invoice ID or /i/ + Invoice ID

Show payform for a given invoice

GET /i/ + Invoice ID + / + Cryptocurrency Code (BTC, LTC, ETH, TRX, XMR)

Show payform only for preselected (in query string) cryptocurrency

Payform handles invoice status checking by itself

GET /i/ + Invoice ID + /eth-token/ + Token Code (DAI, USDT)

Show payform only for preselected (in query string) Ethereum token

GET /i/ + Invoice ID + /tron-token/ + Token Code (BTT, USDT, WIN)

Show payform only for preselected (in query string) Tron token

Payform handles invoice status checking by itself

GET /i/ + Invoice ID + / + Cryptocurrency Code (BTC, LTC, ETH, TRX, XMR) + / + status?invoiceId= + Invoice ID + &paymentMethodId= + Cryptocurrency Code (BTC, LTC, ETH) + &_= + number

Allows to get invoice information, when you know only invoice id (useful for a faster status pulling), also has all connected payment methods details (supported cryptocurrencies details)

GET /i/ + Invoice ID + /eth-token/ + Token Code (DAI, USDT) + / + status?invoiceId= + Invoice ID + &paymentMethodId= + Token Code (DAI, USDT) + &_= + number

GET /i/ + Invoice ID + /tron-token/ + Token Code (BTT, USDT, WIN) + / + status?invoiceId= + Invoice ID + &paymentMethodId= + Token Code (BTT, USDT, WIN) + &_= + number

Allows to get invoice information, when you know only invoice id (useful for a faster status pulling), also has all connected payment methods details (supported cryptocurrencies details)

This is a preferred way to check for invoice status and details, as that way you are not exposing your trade and token directly.

GET /create-demo-invoice

Create demo invoice, shows invoice example, non refundable

Query String Parameters

For GET /invoice?id= + Invoice ID or /i/ + Invoice ID

Query String Required Description
id= Invoice ID true payform for a given invoice

For GET /i/ + Invoice ID + / + Cryptocurrency Code (BTC, LTC, ETH, TRX, XMR) and GET /i/ + Invoice ID + / + Cryptocurrency Code (BTC, LTC, ETH) + / + status?invoiceId= + Invoice ID + &paymentMethodId= + Cryptocurrency Code (BTC, LTC, ETH, TRX, XMR) + &_= + number

Query String Required Description
invoiceId= Invoice ID true invoice id
paymentMethodId= BTC true cryptocurrency code
&_= number true time in range from invoice creation to expiration or just a number

Item Payment URLs (could be attached to button, images etc)

curl 'https://api.forgingblock.io/create-item-sale' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2'

curl 'https://api.forgingblock.io/check-item' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'item=24ea53d945692da5f353b4cd323e7826'

curl 'https://api.forgingblock.io/check-item-status' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'item=24ea53d945692da5f353b4cd323e7826'
// Create new Item Payment URL

var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2';

var options = {
    url: 'https://api.forgingblock.io/create-item-sale',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Check Item Payment Details
var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'item=24ea53d945692da5f353b4cd323e7826';

var options = {
    url: 'https://api.forgingblock.io/check-item',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Create new Item Payment URL */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'trade' => 'Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp',
    'token' => '108977327347814744673750678559203866607310312666213682394904038637537833731647',
    'amount' => '550',
    'currency' => 'rub',
    'description' => 'spoon',
    'email' => 'test@fastmail.mx',
    'count' => '2'
);
$response = Requests::post('https://api.forgingblock.io/create-item-sale', $headers, $data);

/* Check Item Payment Details */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'item' => '24ea53d945692da5f353b4cd323e7826'
);
$response = Requests::post('https://api.forgingblock.io/check-item', $headers, $data);
// Create new Item Payment URL

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-item-sale", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Check Item Payment Details

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{item=24ea53d945692da5f353b4cd323e7826}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/check-item", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"item":"24ea53d945692da5f353b4cd323e7826","amount":"550","currency":"RUB","description":"spoon","url":"https://api.forgingblock.io/item/24ea53d945692da5f353b4cd323e7826"}
{"item":"24ea53d945692da5f353b4cd323e7826","amount":"550","currency":"RUB","description":"spoon","status":false,"invoices":null}
{"status":false}

POST /create-item-sale

Creates new item Payment URL

Payment URL could be attached to any button, image or etc. Ones you open a payment URL new invoice for an item would be generated. And after the last item (check count parameter) would be paid new invoice generation would stop and item status would change to true

It could useful for static websites.

POST /check-item

Check item payment details

POST /check-item-status

Check item status

After the last item (check count parameter) would be paid new invoice generation would stop and item status would change to true

GET /item/ + Item ID

Generate invoice for certain item or show item details (ones all paid)

Parameters

For /create-item-sale

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
currency body [string] true currency
amount body [string] true amount for the price
description body [string] true item description
count body [boolean] true item availability count
email body [string] true email for notification

For /check-item and /check-item-status

Parameter In Type Required Description
item body [string] true item id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

Response Parameters

For /create-item-sale, /check-item, /check-item-status

Parameter Description
item item id
amount amount for the price
description item description
status item status (changes once the last item payed)
currency currency
invoices array with all generated invoices
url item payment url

OPTIONS /create-item-sale, /check-item, /check-item-status

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Crowdfunding

curl 'https://api.forgingblock.io/create-crowdfunding' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=1000&currency=rub&description=cake&email=test%40fastmail.mx'

curl 'https://api.forgingblock.io/check-crowdfunding' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'fund=58e85d60e308043559c8ac9d2efb3c7cae10'

curl 'https://api.forgingblock.io/check-crowdfunding-status' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'fund=58e85d60e308043559c8ac9d2efb3c7cae10'
// Create new Crowdfunding

var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=1000&currency=rub&description=cake&email=test%40fastmail.mx';

var options = {
    url: 'https://api.forgingblock.io/create-crowdfunding',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Check Crowdfunding Details
var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'fund=58e85d60e308043559c8ac9d2efb3c7cae10';

var options = {
    url: 'https://api.forgingblock.io/check-crowdfunding',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Create new Crowdfunding */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'trade' => 'Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp',
    'token' => '108977327347814744673750678559203866607310312666213682394904038637537833731647',
    'amount' => '1000',
    'currency' => 'rub',
    'description' => 'cake',
    'email' => 'test@fastmail.mx'
);
$response = Requests::post('https://api.forgingblock.io/create-crowdfunding', $headers, $data);


/* Check Crowdfunding Details */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'fund' => '58e85d60e308043559c8ac9d2efb3c7cae10'
);
$response = Requests::post('https://api.forgingblock.io/check-crowdfunding', $headers, $data);
// Create new Crowdfunding

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=1000&currency=rub&description=cake&email=test%40fastmail.mx}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-crowdfunding", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}


// Check Crowdfunding Details

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{fund=58e85d60e308043559c8ac9d2efb3c7cae10}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/check-crowdfunding", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"fund":"58e85d60e308043559c8ac9d2efb3c7cae10","amount":"1000","currency":"RUB","description":"spoon","email":"test@fastmail.mx"}
{"fund":"58e85d60e308043559c8ac9d2efb3c7cae12","amount":"1000","currency":"RUB","description":"spoon","status":true,"invoices":["AiTGALf9M2ij6xHk7Xh5UP","NNst8RxtiorxXuVyVdfGqq","CyW1HdAKvKxRCccNVXgNfS","MJbq984yxcwchCneCMr1pK","HM8Jjuno6TSCe3jGYKV3nq"]
{"status":false}

POST /create-crowdfunding

Creates new Crowdfunding

Crowdfunding used to raise certain amount. Once amount is raised crowdfunding status changes to true and GET request with fund ID and amount would stop to generate new invoices

POST /check-crowdfunding

Check crowdfunding details

POST /check-crowdfunding-status

Check crowdfunding status

Once amount is raised crowdfunding status changes to true and GET request with fund ID and amount would stop to generate new invoices

GET /fund/ + Crowdfunding ID + / + Amount

Generates invoice for any amount to participate in the Crowdfunding

You could design images or buttons and specify exact amount inside URL if there any need of it Ones crowdfunding amount is raised invoice generation would stop, and it would show crowdfunding details

Parameters

For /create-crowdfunding

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
currency body [string] true currency
amount body [string] true amount for the price
description body [string] true item description
email body [string] true email for notification

For /check-crowdfunding and /check-crowdfunding-status

Parameter In Type Required Description
fund body [string] true crowdfunding id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

Response Parameters

For /create-crowdfunding, /check-crowdfunding and /check-crowdfunding-status

Parameter Description
fund crowdfunding id
amount amount to raise (goal)
description crowdfunding description or purpose
status crowdfunding status (changes once amount is collected)
currency currency
invoices array with all generated invoices
balance total amount collected

OPTIONS /create-crowdfunding, /check-crowdfunding and /check-crowdfunding-status

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Subscription

curl 'https://api.forgingblock.io/create-subscription'  -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2&days=1'

curl 'https://api.forgingblock.io/check-subscription'  -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'subscription=458d16401c85fc17c4e4b64016c09e29'

curl 'https://api.forgingblock.io/check-subscription-status'  -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'subscription=458d16401c85fc17c4e4b64016c09e29'
// Create New Subscription

var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2&days=1';

var options = {
    url: 'https://api.forgingblock.io/create-subscription',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Check Subscription Details
var request = require('request');

var headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache'
};

var dataString = 'subscription=458d16401c85fc17c4e4b64016c09e29';

var options = {
    url: 'https://api.forgingblock.io/check-subscription',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
/* Create New Subscription */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'trade' => 'Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp',
    'token' => '108977327347814744673750678559203866607310312666213682394904038637537833731647',
    'amount' => '550',
    'currency' => 'rub',
    'description' => 'spoon',
    'email' => 'test@fastmail.mx',
	'count' => '2',
	'days' => '1'
);
$response = Requests::post('https://api.forgingblock.io/create-subscription', $headers, $data);

/* Check Subscription Details */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
    'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language' => 'en-US,en;q=0.5',
    'Content-Type' => 'application/x-www-form-urlencoded',
    'DNT' => '1',
    'Connection' => 'keep-alive',
    'Upgrade-Insecure-Requests' => '1',
    'Pragma' => 'no-cache',
    'Cache-Control' => 'no-cache'
);
$data = array(
    'subscription' => '458d16401c85fc17c4e4b64016c09e29'
);
$response = Requests::post('https://api.forgingblock.io/check-subscription', $headers, $data);
// Create New Subscription

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{trade=Agozs1WFhSk3zxELPoBDrFaZty5bWPHdZeAeQAHV8gqp&token=108977327347814744673750678559203866607310312666213682394904038637537833731647&amount=550&currency=rub&description=spoon&email=test%40fastmail.mx&count=2&days=1}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-subscription", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Check Subscription Details

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{subscription=458d16401c85fc17c4e4b64016c09e29}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/check-subscription", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "en-US,en;q=0.5")
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"subscription":"458d16401c85fc17c4e4b64016c09e29","amount":"1550","currency":"RUB","description":"nice_service","status":false,"invoices":["RbgRj6HYQhDRZW6yffoYAD","5ivvuTrvcSx7Uegivty9pN"],"days":1}
{"status":false}

POST /create-subscription

Creates new Subscription

Subscription URL could be attached to any button, image or etc. Ones you open a subscription URL new invoice for an subscription would be generated. And after the last subscription (check count parameter) would be paid new invoice generation would stop and item status would change to true. days parameter is number of days to remind pay for subscription on customer email. So for ex. 15 would send email remind to pay for subscription every fifteen days.

POST /check-subscription

Check subscription details

POST /check-subscription-status

Check subscription status

After the last subscription (check count parameter) would be paid new invoice generation would stop and subscription status would change to true

GET /subscription/ + Subscription ID

Generate invoice for certain subscription or show subscription details (ones all paid)

Parameters

For /create-subscription

Parameter In Type Required Description
trade body [string] true trade agreement id
token body [string] true token
currency body [string] true currency
amount body [string] true amount for the price
description body [string] true item description
count body [boolean] true item availability count
email body [string] true email for notification
days body [string] true days to send remind on email

For /check-subscription and /check-subscription-status

Parameter In Type Required Description
subscription body [string] true subscription id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

Response Parameters

For /create-subscription, /check-subscription, /check-subscription-status

Parameter Description
subscription subscription id
amount amount for the price
description item description
status item status (changes once the last item payed)
currency currency
invoices array with all generated invoices
url subscription url
days days to send remind on email

OPTIONS /create-subscription, /check-subscription, /check-subscription-status

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Account management

curl 'https://api.forgingblock.io/reset-password' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io'

curl 'https://api.forgingblock.io/change-email' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&newemail=test2%40forgingblock.io'

curl 'https://api.forgingblock.io/change-password' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'mail=test%40forgingblock.io&password=AeNu3miG7nahg&newpassword=myhardpwdAeng2uabohcehhh'

curl 'https://api.forgingblock.io/invoice/status?invoiceId=7hqLE4VN5eS5DyhZLzCVby&paymentMethodId=BTC&_=1553785920269'
// Reset password

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io';

var options = {
    url: 'https://api.forgingblock.io/reset-password',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Change email
var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&newemail=test2%40forgingblock.io';

var options = {
    url: 'https://api.forgingblock.io/change-email',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Change password

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'mail=test%40forgingblock.io&password=AeNu3miG7nahg&newpassword=myhardpwdAeng2uabohcehhh';

var options = {
    url: 'https://api.forgingblock.io/change-password',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

/* Reset password */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io'
);
$response = Requests::post('https://api.forgingblock.io/reset-password', $headers, $data);

/* Change email */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'newemail' => 'test2@forgingblock.io'
);
$response = Requests::post('https://api.forgingblock.io/change-email', $headers, $data);

/* Change password */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'mail' => 'test@forgingblock.io',
    'password' => 'AeNu3miG7nahg',
    'newpassword' => 'myhardpwdAeng2uabohcehhh'
);
$response = Requests::post('https://api.forgingblock.io/change-password', $headers, $data);
// Reset password

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/reset-password", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Change email

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&newemail=test2%40forgingblock.io}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/change-email", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Change password

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{mail=test%40forgingblock.io&password=AeNu3miG7nahg&newpassword=myhardpwdAeng2uabohcehhh}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/change-password", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("DNT", "1")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Pragma", "no-cache")
	req.Header.Set("Cache-Control", "no-cache")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"success":"Check email inbox for reset link"}
{"success":"Check email inbox for email change link"}
{"success":"Password has been changed"}

POST /reset-password

Used to reset password

POST /change-email

Used to change email

POST /change-password

Used to change password

Password requirements:

Parameters

Parameter In Type Required Description Scope
email body [string] true email reset-password, change-email, change-password
password body [string] true strong password change-email, change-password
newpassword body [string] true new strong password change-password
newemail body [string] true new email for password restore change-email

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /reset-password, /change-email and /change-password

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Backward Compatibility with BitPay API

Backward compatibility allows to use invoicing and authorization similar way as for BitPay API

POST /invoices

Creates an invoice for the calling merchant.

Fully compatible with BitPay API

GET /invoices

Retrieves invoices for the calling merchant filtered by query.

Fully compatible with BitPay API

POST /create-pairing

Used to create pairing code

curl 'https://api.forgingblock.io/create-pairing' -H 'Content-Type: application/x-www-form-urlencoded' --data 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=G8j4C7tEAYVotK2XR6L12senoZLkYjXy1sNXsmGc9d6F'
var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};

var dataString = 'email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=G8j4C7tEAYVotK2XR6L12senoZLkYjXy1sNXsmGc9d6F';

var options = {
    url: 'https://api.forgingblock.io/create-pairing',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);


<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce',
    'store' => 'G8j4C7tEAYVotK2XR6L12senoZLkYjXy1sNXsmGc9d6F'
);
$response = Requests::post('https://api.forgingblock.io/create-pairing', $headers, $data);
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test%40forgingblock.io&password=myhardpwdAeng2uabohce&store=G8j4C7tEAYVotK2XR6L12senoZLkYjXy1sNXsmGc9d6F}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/create-pairing", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"pairng":"2pqz9hz"}

POST /tokens

Used to receive API access using pairing

Parameters

For /tokens

Parameter In Type Required Description
guid body [string] true parameter to enforce idempotence for POST requests
id body [string] true client id
label body [string] true label for a client
pairingCode body [string] true pairing code

For /create-pairing

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
store body [string] true store id

Responses

Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

OPTIONS /tokens and /create-pairing

Response without content, but with supported methods

Status Meaning Description Schema
204 No Content No Content None

Using API in client-side applications

Sometimes when its security reliable in some client-side applications cookie authentication could be used.

Cookie is valid for 6 hours and it allows to avoid providing email and password or trade and token continuously for certain api calls.

However store param should be provided instead of trade and token

Section bellow only list calls that support cookie. So make sure you read above sections to know full details.

curl 'https://api.forgingblock.io/signin' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'email=test@forgingblock.io&password=myhardpwdAeng2uabohce'

curl 'https://api.forgingblock.io/signout'
// Sign In

var request = require('request');

var headers = {
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
};

var dataString = 'email=test@forgingblock.io&password=myhardpwdAeng2uabohce';

var options = {
    url: 'https://api.forgingblock.io/signin',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

// Sign Out

var request = require('request');

var options = {
    url: 'https://api.forgingblock.io/signout'
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

/* Sign In */

<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'
);
$data = array(
    'email' => 'test@forgingblock.io',
    'password' => 'myhardpwdAeng2uabohce'
);
$response = Requests::post('https://api.forgingblock.io/signin', $headers, $data);

/* Sign Out */
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array();
$response = Requests::get('https://api.forgingblock.io/signout', $headers);
// Sign In

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	var data = []byte(`{email=test@forgingblock.io&password=myhardpwdAeng2uabohce}`)
	req, err := http.NewRequest("POST", "https://api.forgingblock.io/signin", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

// Sign Out
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "https://api.forgingblock.io/signout", nil)
	if err != nil {
		log.Fatal(err)
	}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	bodyText, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}

Response examples:

{"success":"Sign In success"}
{"success":"Sign Out success"}

POST /signin

Sets 6 hours long cookie

For testing purposes /test/login.html webpage could be use to login.

Cookie could be find under name __forgingblock in cookie store

GET /signout

Sets expired cookie

For /signin

Parameter In Type Required Description
email body [string] true email
password body [string] true strong password
Status Meaning Description Schema
200 OK Request has succeeded None
400 Bad Request Malformed request syntax None
422 Unprocessable Entity Unable to be processed None

This section only list calls that support cookie. So make sure you read above sections to know full details.

Integrations

We provide several plugins for popular e-commerce software.

Supported e-commerce engines:

Integration with WooCommerce

Integration with PrestaShop

Integration with OpenCart

Integration with Zen Cart

Integration with Magento 2

Create Pairing Code