ForgingBlock 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.
The Forgingblock API provides a unified, user friendly and secure layer for developers to build their applications with support for different cryptocurrencies.
Baseurl:
API POST requests are made using Content-Type: "application/x-www-form-urlencoded"
Dashboard:
- Dashboard https://dash.forgingblock.io
Create Demo Invoice:
Shows invoice example, non refundable
Access Tokens
Use Dashboard to register new account and to create a new store.
Most operations are perfomed using trade
and token
access tokens. Those access tokens are private and shouldn't be shared with anyone, including Forgingblock Support.
- Trade is used as proof of ownership of certain storeId.
- Token gives access to create invoices.
Email and password are recommended to use for only Dashboard access.
- Email and password are used for access and control over your user account.
Cryptocurrency support
Could accept multiple payments simultaneously.
Scalable, generates client-side mnemonic on the setup that merchant need to keep safe, as it couldn't be restored.
Invoice Management
Every new invoice lifetime is 15 minutes (avoiding volatility fluctuations) Invoice lifetime could be changed manually
Invoice status:
new
(invoice has not yet been fully paid)confirmed
(received payment)expired
(can no longer receive payments)
Lightning invoices (payment requests) could override expired
status
Secondary status:
Available only after invoice is expired or received payment
overpayment
(received the payment or received greater than requested)underpayment
(received payment for less than requested)
Invoicing
curl 'https://api.forgingblock.io/v2/create-invoice' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=1550¤cy=usd'
curl 'https://api.forgingblock.io/v2/check-invoice' -H 'Content-Type: application/x-www-form-urlencoded' --data 'invoice=W1a7qBnyXGaSGhqEbWziMp'
curl 'https://api.forgingblock.io/v2/check-invoice-status' -H 'Content-Type: application/x-www-form-urlencoded' --data 'invoice=W1a7qBnyXGaSGhqEbWziMp'
// Create new invoice
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166',
'amount': '1550',
'currency': 'usd'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/create-invoice',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Get invoice details
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'invoice': 'W1a7qBnyXGaSGhqEbWziMp'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/check-invoice',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Get invoice status
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'invoice': 'W1a7qBnyXGaSGhqEbWziMp'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/check-invoice-status',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Create new invoice */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/create-invoice');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166',
'amount' => '1550',
'currency' => 'usd'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Get invoice details */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/check-invoice');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'invoice' => 'W1a7qBnyXGaSGhqEbWziMp'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Get invoice status */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/check-invoice-status');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'invoice' => 'W1a7qBnyXGaSGhqEbWziMp'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Create new invoice
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/create-invoice"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=1550¤cy=usd")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Get invoice details
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/check-invoice"
method := "POST"
payload := strings.NewReader("invoice=W1a7qBnyXGaSGhqEbWziMp")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Get invoice status
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/check-invoice-status"
method := "POST"
payload := strings.NewReader("invoice=W1a7qBnyXGaSGhqEbWziMp")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
{
"id": "XzZd7DdJAosdtR3Qvf3jnr",
"currency": "USD",
"realAmount": "0.08627969",
"btcPrice": "0.08627969",
"status": "new",
"url": "https://api.forgingblock.io/invoice?id=XzZd7DdJAosdtR3Qvf3jnr"
}
{
"uiSettings": {
"extensionPartial": "Bitcoin_Lightning_LikeMethodCheckout",
"checkoutBodyVueComponentName": "BitcoinLightningLikeMethodCheckout",
"checkoutHeaderVueComponentName": "BitcoinLightningLikeMethodCheckoutHeader",
"noScriptPartialName": "Bitcoin_Lightning_LikeMethodCheckoutNoScript"
},
"htmlTitle": "ForgingBlock Invoice",
"defaultLang": "en",
"isModal": "false",
"isLightning": "false",
"cryptoCode": "BTC",
"invoiceId": "W1a7qBnyXGaSGhqEbWziMp",
"btcAddress": "1EsPmXNT6ZCr1VUXqdpM9aK1dFJCgNp3Xo",
"btcDue": "0.00060601",
"customerEmail": null,
"businessName": "Wptest",
"businessUrl": "https://test.com",
"businessContact": "test@fastmail.mx",
"invoiceTotalExpirationTime": 30,
"invoiceCreatedDate": "2022-12-28T11:58:01.000Z",
"invoiceExpirationDate": "2022-12-28T12:28:01.000Z",
"checkoutId": "ac1383dc5a8c79156f5e2a72ac889550",
"checkoutCurrency": "USD",
"checkoutAmount": "10",
"checkoutDescription": "Just test",
"checkoutEmail": "TEST@FMGUY.COM",
"checkoutCount": 0,
"checkoutName": "test",
"requiresRefundEmail": "true",
"status": "expired",
"merchantRefLink": "/",
"maxTimeSeconds": 1800,
"storeName": "newName2",
"timeLeft": "00:00",
"rate": "16501.3 USD",
"orderAmount": 0.00060601,
"orderAmountFiat": "10 USD",
"btcPaid": "0.00000000",
"orderId": null,
"isMultiCurrency": false,
"maxTimeMinutes": 30,
"paymentType": null,
"paymentMethodId": "BTC",
"paymentMethodName": "Bitcoin",
"cryptoImage": "/imlegacy/bitcoin.svg",
"storeId": "EyhGReaGRxywkq9iUnRTxG1unAZbqnUA7CFdyfvEGs8q",
"peerInfo": null,
"rootPath": "/",
"redirectAutomatically": false
}
POST /v2/create-invoice
Create new invoice
POST /v2/check-invoice
Get invoice details
POST /v2/check-invoice-status
Get invoice status
Same as /v2/check-invoice
, exist for backward compatibility
status
contains invoice status
Parameters
For /v2/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 /v2/check-invoice
and /v2/check-invoice-status
Parameter | In | Type | Required | Description |
---|---|---|---|---|
invoice | body | [string] | true | invoice id |
IPN Response Example & Explanation
IPN is sent in case notification
parameter is provided. Main IPN purpose is to send notifications to e-commerce software.
You could check guide section Integrate ForgingBlock Payment Gateway to your own applications and backend to get example how to handle IPN.
Also, take a look on IPN Code Sample Repo
{
"id": "QqZDsqZZNAKqNau23yX9n1",
"url": "https://api.forgingblock.io/i/QqZDsqZZNAKqNau23yX9n1/BTC",
"posData": null,
"status": "paid",
"btcPrice": "0.00000213",
"btcPaid": "0.00000213",
"btcDue": "0"
}
Invoice History
In Dashboard you could find Invoice History in Payments
curl 'https://api.forgingblock.io/v2/invoices-range' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&start=2024-01-01&end=2025-01-08&limit=15&offset=0&full=yes'
curl 'https://api.forgingblock.io/get-store-all-invoices' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
// Get invoices invoices for a store
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'start': '2024-01-01',
'end': '2025-01-08',
'limit': '15',
'offset' '0',
'full': 'yes'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/invoices-range',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// All created invoices IDs
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/get-store-all-invoices',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Get invoices history for a store */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/invoices-range');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'start' => '2024-01-01',
'end' => '2025-01-08',
'limit' => '15',
'offset' => '0',
'full' => 'yes'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* All created invoices IDs */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/get-store-all-invoices');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Get invoices history for a store
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/invoices-range"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&start=2024-01-01&end=2025-01-08&limit=15&offset=0&full=yes")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// All created invoices IDs
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/get-store-all-invoices"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
[
{
"InvoiceCurrency": "USD",
"InvoicePrice": 0.1,
"CustomerEmail": "test@fastmail.mx",
"OrderId": null,
"InvoiceId": "CQhV4YH4qY82ZrP8tnLQv6",
"InvoiceCreatedDate": "2024-01-19T14:25:18.000Z",
"InvoiceStatus": "confirmed",
"CryptoCode": "BTC",
"Paid": "0.00100000",
"CryptoToken": null,
"InvoiceUrl": "https://api-demo.forgingblock.io/i/CQhV4YH4qY82ZrP8tnLQv6/BTC",
"Tx": "https://blockstream.info/testnet/address/n1fCYt96dy4VpQHhU1wuEZj823RekmD5ne",
"TxDetails": "https://api.blockcypher.com/v1/btc/test3/addrs/n1fCYt96dy4VpQHhU1wuEZj823RekmD5ne?after=2574285&before=2574287",
"PaidCrypto": "0.00100000 BTC",
"ProductName": "1",
"ExtendedStatus": "overpayment",
"FeeCrypto": "0.00000500",
"FeeFiat": "0.212930"
},
{
"InvoiceCurrency": "USD",
"InvoicePrice": 0.1,
"CustomerEmail": "test@fastmail.mx",
"OrderId": null,
"InvoiceId": "USccwhH66Kyf5J8LX6shex",
"InvoiceCreatedDate": "2024-01-19T15:04:52.000Z",
"InvoiceStatus": "confirmed",
"CryptoCode": "ETH",
"Paid": "0.01000000",
"CryptoToken": null,
"InvoiceUrl": "https://api-demo.forgingblock.io/i/USccwhH66Kyf5J8LX6shex/ETH",
"Tx": "https://goerli.etherscan.io/tx/0xabdc65d175dd25995244903c19ae0c65c99c71eb901e23947457102852219764",
"TxDetails": "https://api-goerli.etherscan.io/api?module=account&action=txlist&address=0xa21746298f5F9c5A5463e85C19A2d11c491f646b&startblock=10400121&page=1&endblock=10400124&sort=desc&apikey=YourApiKeyToken",
"PaidCrypto": "0.01000000 ETH",
"ProductName": "1",
"ExtendedStatus": "overpayment",
"FeeCrypto": "0.00003150",
"FeeFiat": "0.079560"
}
]
{
"invoices": [
[
"9M9ms2gvH5smNfy1FpH1y9"
],
[
"jYEFepK1bEKm48bD3nCKw"
],
...
]
}
POST /v2/invoices-range
Get history with all confirmed
invoices for a store
Provide full=yes
to /v2/invoices-range
in order to receive invoices in all statuses
POST /get-store-all-invoices
Get all previously created invoices IDs as array
Parameters
For /v2/invoices
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
full | body | [string] | false | provide all invoice statuses in response |
start | body | [string] | true | start date |
end | body | [string] | true | end date |
limit | body | [string] | true | limit number of invoices (up to 1000) |
offset | body | [string] | true | offset certain number of invoices |
For /get-store-all-invoices
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
Checkout
You could find in Accept payments -> Sell a Product
in Dashboard
curl 'https://api.forgingblock.io/create-item-sale' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=550¤cy=usd&description=spoon&email=test%40fastmail.mx&count=2&name=bestspoon'
curl 'https://api.forgingblock.io/check-item' -H 'Content-Type: application/x-www-form-urlencoded' --data 'item=327dc71fa54d07bc28f2e81c2c79fdad'
curl 'https://api.forgingblock.io/check-item-status' -H 'Content-Type: application/x-www-form-urlencoded' --data 'item=327dc71fa54d07bc28f2e81c2c79fdad'
curl 'https://api.forgingblock.io/items-list' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166'
curl 'https://api.forgingblock.io/v2/checkout-update' -H 'Content-Type: application/x-www-form-urlencoded' --data 'item=327dc71fa54d07bc28f2e81c2c79fdad&description=thebesttool&name=product1&trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&count=12'
// Create new Checkout
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166',
'amount': '550',
'currency': 'usd',
'description': 'Item description',
'count': '2',
'name': 'device',
'email': 'test@fastmail.mx'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/create-item-sale',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Checkout Payment Details
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'item': '327dc71fa54d07bc28f2e81c2c79fdad'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/check-item',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Display Details for All Ever Created Checkouts
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/items-list',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Modify Checkout Payment Details
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166',
'description': 'Item description 2',
'count': '11',
'name': 'device2',
'item': '327dc71fa54d07bc28f2e81c2c79fdad'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/checkout-update',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Create new Checkout */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/create-item-sale');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166',
'amount' => '550',
'currency' => 'usd',
'description' => 'Item description',
'count' => '2',
'name' => 'device',
'email' => 'test@fastmail.mx'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Check Checkout Payment Details */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/check-item');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'item' => '327dc71fa54d07bc28f2e81c2c79fdad'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Display Details for All Ever Created Checkouts */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/items-list');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Modify Checkout Details */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/checkout-update');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166',
'description' => 'Item description 2',
'count' => '11',
'name' => 'device2',
'item' => '327dc71fa54d07bc28f2e81c2c79fdad'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Create new Checkout
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/create-item-sale"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=550¤cy=usd&description=Item%20description&count=2&name=device&email=test%40fastmail.mx")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Check Checkout Payment Details
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/check-item"
method := "POST"
payload := strings.NewReader("item=327dc71fa54d07bc28f2e81c2c79fdad")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Display Details for All Ever Checkouts
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/items-list"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Modify Checkout Payment Details
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/checkout-update"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&description=Item%20description%202&count=11&name=device2&item=327dc71fa54d07bc28f2e81c2c79fdad")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
{
"item": "5a29847ff8acfcb094257f9a926174a7",
"amount": "550",
"currency": "USD",
"description": "Item description",
"url": "https://api.forgingblock.io/item/5a29847ff8acfcb094257f9a926174a7",
"name": "device"
}
{
"item": "327dc71fa54d07bc28f2e81c2c79fdad",
"amount": "0.1",
"currency": "USD",
"description": "Item description 2",
"status": false,
"invoices": [
"KxATgNW325Zdbequy6QXbZ",
"V3EMdbp311a79qfc1d4W7P",
...
],
"count": 11,
"name": "device2",
"multiple": false,
"items": null
}
{"status":false}
{
"items": [
{
"item": "53e201abc05a1d00935e4768c20471a9",
"email": "test@fastmail.mx",
"currency": "USD",
"amount": "0.1",
"description": "Item description",
"invoices": null,
"count": 2,
"name": "device",
"items": null
},
{
"item": "c824524b1a5fccb4c255dcda2a009d92",
"email": "test@fastmail.mx",
"currency": "USD",
"amount": "0.1",
"description": "Item description",
"invoices": null,
"count": 2,
"name": "device",
"items": null
},
{
"item": "ac1383dc5a8c79156f5e2a72ac889550",
"email": "TEST@FMGUY.COM",
"currency": "USD",
"amount": "10",
"description": "Just test",
"invoices": [
"Wxb5UxR6KR5zbAgFcioJqk",
"NcVnVdE8fyb35rtFo1qoh7",
"BWJR4kKVPZUeyCHHiqjLJq",
"Ff8567Vse9XJwqAq6v956y",
"8StXdBkePEcxpgpUVN7qEn",
"Bp47b7Ar5d4HZkUxKqh1ef",
"usGc9eSYadLBiE2zyBkyK",
"W1a7qBnyXGaSGhqEbWziMp"
],
"count": 0,
"name": "test",
"items": null
},
...
]
}
{
"item": "327dc71fa54d07bc28f2e81c2c79fdad",
"amount": "0.1",
"currency": "USD",
"description": "Item description 2",
"status": false,
"invoices": [
"KxATgNW325Zdbequy6QXbZ",
"V3EMdbp311a79qfc1d4W7P",
"PTt3XNLUBqZvZHu11Pn84d",
...
],
"name": "device2",
"count": 11
}
POST /create-item-sale
Creates new Checkout
Once you open a payment URL, a new invoice for Checkout will be generated.
And after the last item (check count
parameter) is paid, new invoice generation will stop and item status
will change to true
0
count creates unlimited stock and new invoice generation wouldn't ever stop
It could useful for static websites without Cart system.
POST /check-item
Check Checkout details
POST /check-item-status
Check Checkout status
After the last item (check count
parameter) is paid new invoice generation will stop and item status
would change to true
POST /items-list
Details for All Ever Checkouts
GET /item/ + Item ID
Generate invoice for certain item or show item details (ones all paid)
POST /v2/checkout-update
Update Checkout payment details
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 |
name | body | [string] | true | item name |
count | body | [boolean] | true | item availability count |
body | [string] | true | email for notification | |
notification | body | [string] | true | URL for IPN (must include http or https) |
For /check-item
and /check-item-status
Parameter | In | Type | Required | Description |
---|---|---|---|---|
item | body | [string] | true | item id |
For /items-list
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
For /v2/checkout-update
Parameter | In | Type | Required | Description |
---|---|---|---|---|
item | body | [string] | true | item id |
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
description | body | [string] | true | item description |
name | body | [string] | true | item name |
count | body | [boolean] | true | item availability count |
Response Parameters
For /create-item-sale
, /check-item
, /check-item-status
, /v2/checkout-update
Parameter | Description |
---|---|
item | item id |
amount | amount for the price |
description | item description |
status | item status (changes once the last item payed) |
currency | currency |
name | body |
invoices | array with all generated invoices |
url | item payment url |
For /items-list
Array with values for: item, email, currency, amount, description, invoices, count
Parameter | Description |
---|---|
item | item id |
amount | amount for the price |
description | item description |
status | item status (changes once the last item payed) |
currency | currency |
name | body |
invoices | array with all generated invoices |
url | item payment url |
Crowdfunding or Donations
You could find in Accept payments -> Accept Donations in Dashboard
curl 'https://api.forgingblock.io/create-crowdfunding' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=9.55¤cy=usd&description=Fund_description&email=test%40fastmail.mx&name=Crowdfunding_campaign_name'
curl 'https://api.forgingblock.io/check-crowdfunding' -H 'Content-Type: application/x-www-form-urlencoded' --data 'fund=58e85d60e308043559c8ac9d2efb3c7cae10'
curl 'https://api.forgingblock.io/check-crowdfunding-status' -H 'Content-Type: application/x-www-form-urlencoded' --data 'fund=58e85d60e308043559c8ac9d2efb3c7cae10'
curl 'https://api.forgingblock.io/crowdfunds-list' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166'
curl 'https://api.forgingblock.io/crowdfunding-donations' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&fund=58e85d60e308043559c8ac9d2efb3c7cae10'
// Create new Crowdfunding
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166',
'amount': '9.55',
'currency': 'usd',
'description': 'Fund description',
'email': 'TEST@FMGUY.COM',
'name': 'Crowdfunding_campaign_name'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/create-crowdfunding',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Check Crowdfunding Details
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'fund': '1897676b5bc8ead155884910414dfd45f107'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/check-crowdfunding',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Display Details for All Ever Created Crowdfunds
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token': '769861935592995096388092186007720621311273005537151914971703166'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/crowdfunds-list',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Display Donations Details
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'fund': '58e85d60e308043559c8ac9d2efb3c7cae10',
'token': '769861935592995096388092186007720621311273005537151914971703166'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/crowdfunding-donations',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Create new Crowdfunding */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/create-crowdfunding');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166',
'amount' => '9.55',
'currency' => 'usd',
'description' => 'Fund description',
'email' => 'TEST@FMGUY.COM',
'name' => 'Crowdfunding_campaign_name'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Check Crowdfunding Details */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/check-crowdfunding');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'fund' => '1897676b5bc8ead155884910414dfd45f107'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Display Donations Details */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/crowdfunding-donations');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'fund' => '1897676b5bc8ead155884910414dfd45f107',
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'token' => '769861935592995096388092186007720621311273005537151914971703166'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Create new Crowdfunding
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/create-crowdfunding"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&amount=9.55¤cy=usd&description=Fund%20description&email=TEST%40FMGUY.COM&name=Crowdfunding_campaign_name")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Check Crowdfunding Details
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/check-crowdfunding"
method := "POST"
payload := strings.NewReader("fund=1897676b5bc8ead155884910414dfd45f107")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Display Details for All Ever Created Crowdfunds
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/crowdfunds-list"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Display Donations Details
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
client := &http.Client{}
var data = []byte(`{trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&fund=58e85d60e308043559c8ac9d2efb3c7cae10}`)
req, err := http.NewRequest("POST", "https://api.forgingblock.io/crowdfunding-donations", 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:
{
"fund": "eae2b2aabfa7f054ccfe73f1fa2b99d94156",
"amount": "9.55",
"currency": "USD",
"description": "Fund description",
"name": "Crowdfunding_campaign_name"
}
{
"fund": "1897676b5bc8ead155884910414dfd45f107",
"amount": "9.55",
"currency": "USD",
"description": "Fund description",
"status": false,
"invoices": [
"6KN6ScSsWnhwTh5AvY8VuU",
"2fb5R9BXMGz3EYnPqJKPrk",
"SXLG7ctaESZMgm5wfZh6RR",
"HxPEFX2P9iSGMTYvqReFfC",
"JsHDstR6KvZ86LY41TNv9u",
...
],
"name": "Crowdfunding_campaign_name"
}
{
"status": false
}
{
"funds": [
{
"fund": "47285ccd8e45e887ffd4a0e79201e276cd46",
"email": "TEST@FMGUY.COM",
"currency": "USD",
"amount": "9.55",
"description": "Fund description",
"invoices": null,
"name": "Crowdfunding_campaign_name"
},
{
"fund": "ad2588bb4e4df43ff30590a8fc5780ec84be",
"email": "TEST@FMGUY.COM",
"currency": "USD",
"amount": "9.55",
"description": "Fund description",
"invoices": null,
"name": "Crowdfunding_campaign_name"
},
...
]
}
{
"donations": [
{
"invoice": "5dB3RVM7nnckEwKRcvVqoQ",
"created": "2019-10-25T14:29:32.000Z",
"participantEmail": "1@test.me",
"status": "complete"
}
]
}
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 generatе 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 generating new invoices
POST /crowdfunds-list
Details for All Ever Created Crowdfunds
POST /crowdfunding-donations
Crowdfunding Donations Details
Displays private information with participants of crowdfunding (donations), includes participant email (email that was provided for the invoice)
GET /fund/ + Crowdfunding ID + / + Amount
Generates invoice for any amount to participate in the Crowdfunding
Ex. GET https://api.forgingblock.io/fund/1897676b5bc8ead155884910414dfd45f107/20
Asks for 20 USD donation
Ex. GET https://api.forgingblock.io/fund/1897676b5bc8ead155884910414dfd45f107/50
Asks for 50 USD donation
Once amount you used to create Crowdfunding is raised crowdfunding status
changes to true
and GET request with fund
ID and amount
would stop to generating new invoices
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 | crowdfunding description |
name | body | [string] | true | crowdfunding campaign name |
body | [string] | true | email for notification | |
notification | body | [string] | true | URL for IPN (must include http or https) |
For /check-crowdfunding
and /check-crowdfunding-status
Parameter | In | Type | Required | Description |
---|---|---|---|---|
fund | body | [string] | true | crowdfunding id |
For /crowdfunds-list
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
For /crowdfunding-donations
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
fund | body | [string] | true | crowdfunding id |
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 |
For /crowdfunds-list
Array with values for: Crowdfunding ID (fund), email, currency, amount, description, invoices IDs
For /crowdfunding-donations
Array with values for: Invoice ID, Invoice Creation Time, Participant's email, Invoice Status
[Advanced] Withdrawal History
Could be found as Withdrawal
in Dashboard
curl 'https://api.forgingblock.io/v2/withdrawal-history' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=2GhhbL55TyYUDqadvvEEpT5AafXynVTjqqTkMHhtW7T4'
// Withdrawal History
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/withdrawal-history',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Withdrawal History */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/withdrawal-history');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Withdrawal History
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/withdrawal-history"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
[
{
"Date": "2025-01-06T22:01:14.665Z",
"Transaction": "3c6120687265663d2268747470733a2f2f6c696768746e696e672e666f7267696e67626c6f636b2e696f2f3f696e766f6963653d6c6e626332307531706e6863353565707035777234347539617670376e67616d78656a6173707476796d736c75327a63676a7464336e686378706579636c353967773734307164717163717a7973787172727373737035356b3632736a6c6c736e6b7230636a687373397033336870327139667135383771736c64766d783361776e686771376c6d6e767139717870717973677139636e6a646776796c3033663036333879366c3564306330346368637775777a757a686a6e326c30376473767a6864646d3663337465726a35707461636d6d3771336671633273366d67333474387535366639356b716c6c61326d336c63676d793965766d6a677138666d34387622207461726765743d225f626c616e6b222072656c3d226e6f6f70656e6572206e6f7265666572726572223e6c6e6263322e2e2e6d3438763c2f613e",
"Recipient": "lnbc20u1pnhc55epp5wr44u9avp7ngamxejasptvymslu2zcgjtd3nhcxpeycl59gw740qdqqcqzysxqrrsssp55k62sjllsnkr0cjhss9p33hp2q9fq587qsldvmx3awnhgq7lmnvq9qxpqysgq9cnjdgvyl03f0638y6l5d0c04chcwuwzuzhjn2l07dsvzhddm6c3terj5ptacmm7q3fqc2s6mg34t8u56f95kqlla2m3lcgmy9evmjgq8fm48v",
"StoreId": "PBQExXAXQeEB7Geu526sf3Zbe99G7efhiyKCgoDnFnJ",
"CryptoCode": "BTC (Lightning)",
"Amount": "0.00002"
},
...
]
POST /v2/withdrawal-history
Retrieve Withdrawal History
in Response Transaction
is hexified href (could be decoded from hex to string)
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
[Advanced] Extending Invoice Expiration Time
curl 'https://api.forgingblock.io/v2/store-invoice-expiration' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=2GhhbL55TyYUDqadvvEEpT5AafXynVTjqqTkMHhtW7T4&time=60'
// Extend invoice expiration time for a store
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'time': '15'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/store-invoice-expiration',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Extend invoice expiration time for a store */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/store-invoice-expiration');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'time' => '15'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Extend invoice expiration time for a store
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/store-invoice-expiration"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&time=15")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
{ success: 'Updated invoice expiration time' }
POST /v2/store-invoice-expiration
Set invoice expiration time
time
parameter is time in minutes, So, for example 30
is 30 minutes. Minimum value for time
is 10, while maximum is 360 minutes
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
time | body | [string] | true | time for expiration in minutes > 10 < 360 |
[Advanced] Attach Image to the Checkout or Crowdfunding
curl --location --request POST 'https://api.forgingblock.io/upload-image' --header 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T' --header 'Content-Type: multipart/form-data' --form 'image=@/home/test/Images/image.jpg'
curl 'https://api.forgingblock.io/get-image' -H 'Content-Type: application/x-www-form-urlencoded' --data 'image=f1934a910f29b509b67511d2491d'
curl 'https://api.forgingblock.io/attach-image' -H 'Content-Type: application/x-www-form-urlencoded' --data 'image=f1934a910f29b509b67511d2491d&id=d28db141cd5b2140adcc170c0d0a4147&&trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
// Upload image
var request = require('request');
var headers = {
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'Content-Type': 'multipart/form-data'
};
var options = {
url: 'https://api.forgingblock.io/upload-image',
method: 'POST',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
// Get image
var request = require('request');
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
};
var dataString = 'image=f1934a910f29b509b67511d2491d';
var options = {
url: 'https://api.forgingblock.io/get-image',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
// Attach image to checkout or crowdfunding
var request = require('request');
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
};
var dataString = 'image=f1934a910f29b509b67511d2491d&id=d28db141cd5b2140adcc170c0d0a4147&trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T';
var options = {
url: 'https://api.forgingblock.io/attach-image',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
/* Upload image */
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'Content-Type' => 'multipart/form-data'
);
$response = Requests::post('https://api.forgingblock.io/upload-image', $headers);
/* Get image */
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
'image' => 'f1934a910f29b509b67511d2491d'
);
$response = Requests::post('https://api.forgingblock.io/get-image', $headers, $data);
/* Attach image to checkout or crowdfunding */
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded'
);
$data = array(
'image' => 'f1934a910f29b509b67511d2491d'
);
$response = Requests::post('https://api.forgingblock.io/attach-image', $headers, $data);
/// Upload image
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("POST", "https://api.forgingblock.io/upload-image", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("trade", "A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T")
req.Header.Set("Content-Type", "multipart/form-data")
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 image
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`image=f1934a910f29b509b67511d2491d`)
req, err := http.NewRequest("POST", "https://api.forgingblock.io/get-image", 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)
}
// Attach image to checkout or crowdfunding
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`image=f1934a910f29b509b67511d2491d&id=d28db141cd5b2140adcc170c0d0a4147&trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T`)
req, err := http.NewRequest("POST", "https://api.forgingblock.io/attach-image", 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:
{"image":"f1934a910f29b509b67511d2491d"}
{"base64":"iVBO...==","mimetype":"image/png"}
{"success": "Image was successfully attached to the: d28db141cd5b2140adcc170c0d0a4147"}
POST /upload-image
Upload image
Uploads image. Image could be attached later to the Checkout or Crowdfunding, uses multipart/form-data
POST /get-image
Get image mimetype and its base64 representation
POST /attach-image
Attach image id to Checkout or Crowdfunding
Attach image id to Checkout or Crowdfunding.
Every new invoice generated that has attached image would have imageId
parameter in status response
[Advanced] Invoice Status
To check the status of an invoice for a specific cryptocurrency, you can use the following API structure:
General Request Format
https://api.forgingblock.io/i/{invoiceId}/{endpoint}/status?invoiceId={invoiceId}&paymentMethodId={paymentMethodId}&_={timestamp}
Where:
{invoiceId}
is the unique ID for the invoice.{endpoint}
corresponds to the cryptocurrency or token type (e.g.,BTC
,ETH
,MATIC
, etc.).{paymentMethodId}
is the corresponding payment method for the cryptocurrency (e.g.,BTC
,ETH
,USDT
, etc.).{timestamp}
is a query parameter used for cache busting (typically set to1
).
Example Request (ETH)
curl "https://api.forgingblock.io/i/4sXgKvGGgCwPQzMzKFRqKV/ETH/status?invoiceId=4sXgKvGGgCwPQzMzKFRqKV&paymentMethodId=ETH&_=1"
Where:
ETH
is the cryptocurrency code.4sXgKvGGgCwPQzMzKFRqKV
is the invoice ID.
Supported Currencies
The following cryptocurrencies codes are supported:
BTC
, ETH
, LIGHTNING
, ARB
, BASE
, BSC
, MATIC
(Polygon)
Supported Tokens
Polygon Tokens (Path: /polygon-token/
)
DAI
Ethereum Tokens (Path: /eth-token/
)
Path is reserved and was used for old invoices, currently Ethereum Tokens are disabled (enjoy low fee on L2)
Arbitrum Tokens (Path: /arb-token/
)
USDT
USDC
Base Tokens (Path: /base-token/
)
USDC
DAI
Supported Paths:
- For Ethereum Tokens:
/eth-token/
- For Arbitrum Tokens:
/arb-token/
- For Base Tokens:
/base-token/
- For Polygon Tokens:
/polygon-token/
Account Control
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 'email=test%40forgingblock.io&password=AeNu3miG7nahg&newpassword=myhardpwdAeng2uabohcehhh'
// Reset password
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'email': 'postman@fastmail.de'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/reset-password',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
request(options, callback);
// Change email
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'email': 'postman@fastmail.de',
'password': 'AeNu3miG7nahg',
'newemail': 'test@forgingblock.io'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/change-email',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Change password
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'email': 'postman@fastmail.de',
'password': 'AeNu3miG7nahg',
'newpassword': 'myhardpwdAeng2uabohcehhh'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/change-password',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Reset password */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/reset-password');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'email' => 'postman@fastmail.de'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Change email */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/change-email');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'email' => 'postman@fastmail.de',
'password' => 'AeNu3miG7nahg',
'newemail' => 'test@forgingblock.io'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Change password */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/change-password');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'email' => 'test@forgingblock.io',
'password' => 'AeNu3miG7nahg',
'newpassword' => 'myhardpwdAeng2uabohcehhh'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// 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(`{email=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")
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:
Do not use common sequences or your private details, add another word or two, consider using lowercase and uppercase and special symbols
- At least 8 characters in length
- At least a zxcvbn score 1
Parameters
Parameter | In | Type | Required | Description | Scope |
---|---|---|---|---|---|
body | [string] | true | reset-password, change-email, change-password | ||
password | body | [string] | true | strong password (zxcvbn score >= 1) | change-email, change-password |
newpassword | body | [string] | true | new strong password (zxcvbn score >= 1) | change-password |
newemail | body | [string] | true | new email for password restore | change-email |
Account Informaton
curl 'https://api.forgingblock.io/v2/provide-business-details' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&business=forgingblock&url=https://forgingblock.io&contact=test%40forgingblock.io'
curl 'https://api.forgingblock.io/v2/update-business-details' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&business=forgingblock&url=https://forgingblock.io&contact=test%40forgingblock.io'
curl 'https://api.forgingblock.io/v2/get-business-details' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
// Provide Business Information
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'business': 'mybiz',
'url': 'https://test.com',
'contact': 'test@fastmail.mx'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/provide-business-details',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Update Business Information
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'business': 'mybiz',
'url': 'https://test.com',
'contact': 'test@fastmail.mx'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/update-business-details',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// Get Business Information
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/get-business-details',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
/* Provide Business Information */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/provide-business-details');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'business' => 'mybiz',
'url' => 'https://test.com',
'contact' => 'test@fastmail.mx'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Update Business Information */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/update-business-details');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'business' => 'mybiz',
'url' => 'https://test.com',
'contact' => 'test@fastmail.mx'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
/* Get Business Information */
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/get-business-details');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
// Provide Business Information
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/provide-business-details"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&business=mybiz&url=https%3A%2F%2Ftest.com&contact=test%40fastmail.mx")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Update Business Information
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/update-business-details"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&business=mybiz&url=https%3A%2F%2Ftest.com&contact=test%40fastmail.mx")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Get Business Information
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/get-business-details"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response examples:
{'success': "New business information received"}
{"business":"forgingblock3","url":"https://api.forgingblock.io"}
POST /v2/provide-business-details
Provide information about business (single run, used during Dashboard setup)
POST /v2/update-business-details
Update already provided information about business
POST /v2/get-business-details
Get information about business
Parameters
Parameter | In | Type | Required | Description | Scope |
---|---|---|---|---|---|
trade | body | [string] | true | trade agreement id | /v2/provide-business-details , /v2/update-business-details , /v2/get-business-details |
business | body | [string] | true | business name | /v2/provide-business-details , /v2/update-business-details |
url | body | [string] | true | website information | /v2/provide-business-details , /v2/update-business-details |
contact | body | [string] | true | store contact email | /v2/provide-business-details , /v2/update-business-details |
Payment Form
Most of the payment form settings could be changed in Dashboard Account Settings
Hide Shipping Information
You could change in Dashboard Account Settings -> Payment Form
[Advanced] Default Cryptocurrency
curl 'https://api.forgingblock.io/v2/wallet-default-currency' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T¤cy=eth'
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'currency': 'eth'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/wallet-default-currency',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/wallet-default-currency');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'currency' => 'eth'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/wallet-default-currency"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T¤cy=eth")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response example:
{
"success": "Default currency information updated"
}
POST /wallet-default-currency
Set default cryptocurrency for the payment form
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
currency | body | [string] | true | cryptocurrency code |
Supported cryptocurrency codes: btc
, eth
, ethTokensUsdt
, ethTokensDai
, polygon
, polygonTokensDai
, bsc
, arb
, arbTokensUsdt
, arbTokensUsdc
, base
, baseTokensUsdc
, baseTokensDai
, baseTokensWeth
[Advanced] Hide Cryptocurrency
curl 'https://api.forgingblock.io/v2/wallet-hide-currency' -H 'Content-Type: application/x-www-form-urlencoded' --data 'trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T¤cy=eth'
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'trade': 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'currency': 'eth'
});
var config = {
method: 'post',
url: 'https://api.forgingblock.io/v2/wallet-hide-currency',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.forgingblock.io/v2/wallet-hide-currency');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'trade' => 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T',
'currency' => 'eth'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.forgingblock.io/v2/wallet-hide-currency"
method := "POST"
payload := strings.NewReader("trade=A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T¤cy=eth")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response example:
{
"success": "Hidden currency information updated"
}
POST /wallet-hide-currency
Hide cryptocurrency from the payment form
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
currency | body | [string] | true | cryptocurrency code |
Supported cryptocurrency codes: btc
, eth
, ethTokensUsdt
, ethTokensDai
, polygon
, polygonTokensDai
, bsc
, arb
, arbTokensUsdt
, arbTokensUsdc
, base
, baseTokensUsdc
, baseTokensDai
, baseTokensWeth
Supported cryptocurrency codes(including supported in the past): btc
, eth
, ethTokensUsdt
, ethTokensDai
, eos
, eosTokensEveripedia
, trx
, trxTokensUsdt
, xmr
, dgb
, xtz
, rdd
, rvn
, xnc
, ksm
, owc
, tusc
, polygon
, polygonTokensEth
, polygonTokensDai
, ethTokensLusd
, bsc
, bscTokensWbnb
, bscTokensBusd
, bscTokensZina
, ethTokensCrv
, ethTokensPickle
, ethTokensAngle
, ethTokensFxs
, ethTokensIdle
, arb
, arbTokensUsdt
, arbTokensUsdc
, arbTokensArb
, base
, baseTokensUsdc
, baseTokensDai
, baseTokensWeth
Integrations
E-commerce Plugins
For actual e-commerce integration information check Crypto Payment Plugins for E-Commerce page with plugins and documentation.
Shopify Integration
You could use Account Settings -> Shopify Integration
in Dashboard instead
curl 'https://api.forgingblock.io/v2/add-shopify-store' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&source=https://username.myshopify.com'
curl 'https://api.forgingblock.io/v2/add-source-shopify-store' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&source=https://username2.myshopify.com'
curl 'https://api.forgingblock.io/v2/remove-source-shopify-store' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166&source=https://username2.myshopify.com'
curl 'https://api.forgingblock.io/v2/get-shopify-store-source' -H 'Content-Type: application/x-www-form-urlencoded' \
--data 'A6mjm8fgDspPdoeTsXUqsLmKKA3UmNNssPA547GjcEG3T&token=769861935592995096388092186007720621311273005537151914971703166'
POST /v2/add-shopify-store
Add Shopify Store for integration (you run this only once on creation), after which you should use /add-source-shopify-store
even if removed all domain URLs
Correct domain name URL examples: https://username.myshopify.com
, https://username.myshopify.com/
, http://username.myshopify.com
, http://mystore.com
, https://mystore.com
, https://mystore.com/
Incorrect domain name URL examples: https://username.myshopify.com/someproductlocation
, https://mystore.com/someproductlocation
, mystore.com
, username.myshopify.com
, https://username.myshopify.com/?_cd=2263d5ac8bde3e6f61ccba03711adc43d0a1cfdcdaaf98536a99c22e3286844c&_uid=61409788069&preview_theme_id=
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
source | body | [string] | true | Shopify Store Domain URL |
POST /v2/add-source-shopify-store
Add Shopify Store Domain URL for integration
Correct domain name URL examples: https://username.myshopify.com
, https://username.myshopify.com/
, http://username.myshopify.com
, http://mystore.com
, https://mystore.com
, https://mystore.com/
Incorrect domain name URL examples: https://username.myshopify.com/someproductlocation
, https://mystore.com/someproductlocation
, mystore.com
, username.myshopify.com
, https://username.myshopify.com/?_cd=2263d5ac8bde3e6f61ccba03711adc43d0a1cfdcdaaf98536a99c22e3286844c&_uid=61409788069&preview_theme_id=
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
source | body | [string] | true | Shopify Store Domain URL |
POST /v2/remove-source-shopify-store
Remove Shopify Store Domain URL from integration
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
source | body | [string] | true | Shopify Store Domain URL to remove |
POST /v2/get-shopify-store-source
Get and Array with current domain URLs for Shopify Store integration
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
trade | body | [string] | true | trade agreement id |
token | body | [string] | true | token |
Library
If you need a library for your code check those:
Node.js library: https://www.npmjs.com/package/forgingblock.js
PHP Library: https://github.com/forgingblock/ForgingBlock-php-lib
IPN Response Example & Explanation
You could check guide section Integrate ForgingBlock Payment Gateway to your own applications and backend to get example how to handle IPN.
Also, take a look on IPN Code Sample Repo
Checkout has support for notification
param for IPN URL as well