BconGlobal

API documentation

Api key

To generate an API key, create a Store, then go to Created Store Settings > Copy Generated Keys. To use the API key, pass it in the request header:

Authorization: Bearer <apikey>

Balance

Returns the balance and bonus balance (Amount waiting 2 confirmations) of the authorized user for the given addresses. Addresses can be listed separated by spaces. The request requires the use of an API key in the header Authorization: Bearer <api key>.

Definition

GET https://external-api.bcon.global/api/v1/user/balanceRequest body: {"address": <Whitespace seperated list of wallets addresses>}

Example Request

curl -d '{"address":"1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp, 1dice97ECuByXAvqXpaYzSaQuPVvrtmz6"}' -H 'Authorization: Bearer 018TmI5IzJPzl3x1uCMZJvii63c8SV9vHMDA' https://external-api.bcon.global/api/v1/user/balance

Example Response

{"status":"Ok","data":{"wallets":[{"id":5197,"address":"bc1qrr3g9kswpfhkmwa6s35rgzgv8a6pjhsmjt43hk","balance":"-0.000000715200000000","balance_bonus":"0.000000000000000000","currency":{"id":1,"name":"BTC","iso_name":"btc"},"created_at":"2023-05-25T06:11:12.000000Z"}]}}

History

Returns transaction history of multiple bitcoin addresses/xpubs considering them part of the same wallet. Transactions are sorted by latest time.

Definition

GET https://external-api.bcon.global/api/v1/user/history
Request body: {"address": <Whitespace seperated list of transactions addresses>}

Example Request

curl -d '{"address":"1JJ5taVeiHcD6DXNkLLfocbHcE9Nzio1qV, 13A1W4jLPP75pzvn2qJ5KyyqG3qPSpb9jM"}' -H 'Authorization: Bearer 2cDNOlCN985d7Rx3atSDOlmMeYaxzho2uPmHheIw4eU' https://external-api.bcon.global/api/v1/user/history

Example Response

{"status":"Ok","data":{"transactions":[{"transaction_id":"0xb46a64ce38730f20a39e9825274f4d253dca9a78879b2ad224def96851da343f","status":"confirmed","preset":"oc-test","tag":"oc-test","currency":{"id":3,"name":"BNB","iso_name":"bnb"},"sum":"0.004437730000000000","created_at":"2023-06-12T07:32:23.000000Z"},{"transaction_id":"0xd553be50ca700ea95d70eae8d669a8f6da50ecdd670e8aa61244e2ce2c6acdcd","status":"confirmed","preset":"oc-test","tag":"oc-test","currency":{"id":3,"name":"BNB","iso_name":"bnb"},"sum":"0.004433600000000000","created_at":"2023-06-12T06:58:25.000000Z"},{"transaction_id":"0x20a28f830a1e056f12ebb515a7fd897134c353f99be0f207cb1e53212cd8d2a4","status":"confirmed","preset":"oc-test","tag":"oc-test","currency":{"id":3,"name":"BNB","iso_name":"bnb"},"sum":"0.004433600000000000","created_at":"2023-06-12T06:50:54.000000Z"},{"transaction_id":"0x460df82df7e3a199fa4b752d4ee5c95aff0fb1f456eb1b149587e3465f92353f","status":"confirmed","preset":null,"tag":null,"currency":{"id":3,"name":"BNB","iso_name":"bnb"},"sum":"0.010496960000000000","created_at":"2023-05-25T06:23:25.000000Z"}],"meta":{"total":4,"currentPage":1,"currentPageTotal":4,"lastPage":1,"perPage":10}}}

Where :

  • Transaction_id - transaction id in blockhain;
  • Status - the status of tx: unconfirmed, partially_confirmed, confirmed ( 2 confirmations );
  • Preset - name of platform in system ( Your Store name );
  • Tag - tag of platform in system ( Tag of your store );
  • Currency - currency ( BNB / BTC );
  • Created_at - date of creating transaction;
  • Meta - pagination to receive subsequent transactions.

PHP code

<?php
$curl = curl_init();

curl_setopt_array($curl, array(  
CURLOPT_URL => 'https://external-api.bcon.global/api/v1/user/history',  CURLOPT_RETURNTRANSFER => true,  
CURLOPT_ENCODING => '',  
CURLOPT_MAXREDIRS => 10,  
CURLOPT_TIMEOUT => 0,  
CURLOPT_FOLLOWLOCATION => true,  
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,  
CURLOPT_CUSTOMREQUEST => 'GET',  
CURLOPT_POSTFIELDS =>'{ "address": "1EocTyfvpq4NheJT8Drcd46AsiQViEtSgq"}',  CURLOPT_HTTPHEADER => 
array(    'Accept: application/json',    
'Content-Type: application/json',    
'Authorization: Bearer xFk3K3xnUrU23wX37c1HyoF2g2LDGdSzpZKDxDSQ'  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>

Transaction Details

Return details of transaction by TxID

Definition

GET https://external-api.bcon.global/api/v1/transactions/<txid>

Example Request

curl https://external-api.bcon.global/api/v1/transactions/c4978bfc9b4cd632fb37eb5f69e72530a4e

Example Response

{"status":"Ok","data":{"transaction":{"id":25383,"transaction_id":"0xb46a64ce38730f20a39e9825274f4d253dca9a78879b2ad224def96851da343f","address":"0xB94522D6d928361111c4956E7ed8A48f0aB9969C","status":"confirmed","sum":"0.004437730000000000","log_line":"https://bcon.global/index.php?addr=0x6dE751cfeb935E90c8bdED1F67E1250F8912f114&status=2&txid=0xb46a64ce38730f20a39e9825274f4d253dca9a78879b2ad224def96851da343f&memo=1203481157&value=0.00443773&route=extension%2Fpayment%2Fcprocessing%2Fcallback&amp%3Bsecret=3ad71073d7e2d3cc261bc88ef5e86f74","store":{"id":212,"xpub":null,"name":"oc-test","name_bnb":null,"tag":"oc-test","tag_bnb":null,"api_key_bnb":"8zuSZ5AFJPscrWBaiZey1kivsejxT2YcqH2h9EgS","callback_url_bnb":"https://bcon.global/index.php?route=extension/payment/cprocessing/callback&secret=05cee5d9d07e0f0e7ada6a7dc07aa0fb","addresses":[{"id":37057,"address":"8913036001","created_at":"2023-06-12T06:48:38.000000Z"},{"id":37058,"address":"5720289312","created_at":"2023-06-12T06:56:39.000000Z"},{"id":37059,"address":"1203481157","created_at":"2023-06-12T07:30:37.000000Z"}],"created_at":"2023-06-12T06:48:16.000000Z"},"currency":{"id":3,"name":"BNB","iso_name":"bnb"},"created_at":"2023-06-12T07:32:23.000000Z"}}}
  • Id - internal id;
  • Transaction_id - ID of transaction in blockchain;
  • Address - output address of transaction;
  • Status - the status of tx: unconfirmed, partially_confirmed, confirmed ( 2 confirmations );
  • Sum - amount of coins;
  • Log_line - url with callback info;
  • Store - info about the Store that receive TX;
  • Currency - BTC / BNB;
  • Date - date & time of transacton.

Store list

Getting a list of stores of an authorized user

GET https://external-api.bcon.global/api/v1/stores/

Example Request

curl -H 'Authorization: Bearer 2cDNOlCN985d7Rx3atSDOlmMeYaxzho2uPmHheIw4eU' https://external-api.bcon.global/api/v1/stores

Example Response

{"status":"Ok","data":{"addresses":[{"id":212,"xpub":null,"binance_address":"0x6dE751cfeb935E90c8bdED1F67E1250F8912f114","name":"oc-test","name_bnb":null,"tag":"oc-test","tag_bnb":null,"api_key":"nJAXAdDWkdRN4PqRFYvTM6kkbZ","api_key_bnb":"8zuSZ5AFJPscrWBaiZ","callback_url":null,"callback_url_bnb":"https://bcon.global/index.php?route=extension/payment/cprocessing/callback&secret=05cee5d9d07e0f0e7ada","created_at":"2023-06-12T06:48:16.000000Z"},{"id":215,"xpub":null,"binance_address":"0x6dE751cfeb935E90c8bdED1F67E1250F8912f114","name":"0x6dE751cfeb935E90c8","name_bnb":null,"tag":"0x6dE751cfeb935E90c8","tag_bnb":null,"api_key":"lFcsUs3BfkT4tCyhSgyOl4CHpkdpCCbWX5hm6uWK","api_key_bnb":"hh8KyzjYTDBIzJ5gWiNb0AWredHz9DXrczwlqMd5","callback_url":null,"callback_url_bnb":"https://bcon.global/?wc-api=WC_Gateway_Cprocessing&secret=c06fcf59ced091fc4625b5","created_at":"2023-06-14T12:17:17.000000Z"},{"id":216,"xpub":"zpub6o1ZT7MMTN9aoskeENCnZZYKfaYZFa6mDx5ubpLTuz5t7bCTryj1K8MkWpksrSYHTeaUuv1GGcXkLim","binance_address":null,"name":"oc-new-test","name_bnb":null,"tag":"oc-new-test","tag_bnb":null,"api_key":"fwrecxVpsmxVk7TqTWHLvSG4pxLxKYQSWyC1Uq0H","api_key_bnb":"pQa9EvOqooUUDvEtSItZUZCQDT8bisEufqrYrXd5","callback_url":"https://bcon.global/index.php?route=extension/payment/cprocessing/callback&amp;secret=05cee5d9d07e0f0","callback_url_bnb":null,"created_at":"2023-06-15T11:09:44.000000Z"},{"id":217,"xpub":"zpub6o1ZT7MMTN9aoskeENCnZZYKfaYZFa6mDx5ubpLTuz5t7bCTryj1K8MkWpksrSYHTeaUv","binance_address":null,"name":"wp-new-test","name_bnb":null,"tag":"wp-new-test","tag_bnb":null,"api_key":"5kmK1jFmSG5MbqTotEdaOzv2VfBEd","api_key_bnb":"DiXZ80xsagoHwasL7aPRTyEz1ekRykaZ","callback_url":"https://bcon.global/?wc-api=WC_Gateway_Cprocessing&secret=ee83e986361f02193e23a0fcccd6849ad4f6a21c","callback_url_bnb":null,"created_at":"2023-06-15T11:13:28.000000Z"}]}}
  • Id - internal id;
  • Xpub - xpub of Store;
  • Name - name of btc Store;
  • Name_bnb - name of bnb Store;
  • Tag - tag of btc Store;
  • Tag_bnb - tag of bnb Store;
  • Api_key - btc api key of Store;
  • Api_key_bnb - bnb api key of Store;
  • Callback_url - btc callback of Store;
  • Callback_url_bnb - bnb callback of Store;
  • Created_at - date of creating Store;

New Address

This endpoint is for creating a new tracking address. It returns the address of the wallet that will accept payments.To get an already existing last address, pass the value 1 in the reset parameter of the request: ?reset=1. Can be used for testing purposes.

Definition

POST https://external-api.bcon.global/api/v1/address
POST https://external-api.bcon.global/api/v1/address?reset=1

Example Request

curl -d '' -H 'Authorization: Bearer 2cDNOlCN985d7Rx3atSDOlmMeYaxzho2uPmHheIw4eU' https://external-api.bcon.global/api/v1/address
curl -d '' -H 'Authorization: Bearer 2cDNOlCN985d7Rx3atSDOlmMeYaxzho2uPmHheIw4eU' https://external-api.bcon.global/api/v1/address?reset=1

Example response

BTC - {"status":"Ok","data":{"message":"Address successfully created","address":"bc1qzcec7fhgw7xfr4la6rqht54y6k9dpnw5hlz6yz"}}
BNB - {"status":"Ok","data":{"message":"Memo successfully created","address":"0x6dE751cfeb935E90c8bdED1F67E1250F8912f114","memo":2845449800}}

PHP code

<?php
$api_key = 'INSERT_API_KEY_HERE';
$url = 'https://external-api.bcon.global/api/address;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$header = "Authorization: Bearer " . $api_key;
$headers = array();
$headers[] = $header;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$contents = curl_exec($ch);
if (curl_errno($ch)) {  echo "Error:" . curl_error($ch);}$responseObj = json_decode($contents);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if ($status == 200) {    echo $responseObj->address;} else {    echo "ERROR: " . $status . ' ' . $responseObj->message;}
?>

HTTP Callback

Bcon.global will send you callback when payment arrives at your trackable address.

Example Callback

/api/callback_url?status=1&addr=1C3FrYaGgUJ8R21jJcwzFpwcrL&value=1537643&txid=4cb30849ffcaf61c0e9a32722ceb6ad5f34e630b4acb7c6dc
  • Status -  the status of transaction: confirmed = 2, partially_confirmed = 1, unconfirmed = 0;
  • Addr - receiving addresss;
  • Value - recevied payment amount;
  • Txid - transaction ID in blockchain. 

A callback succeeds when the server returns 200 HTTP status. Balance units are in satoshis.

PHP code

<?php

$secret = '814fwgr-store-api-gwgwf';
$txid = $_GET['txid'];
$value = $_GET['value'];
$status = $_GET['status'];
$addr = $_GET['addr'];

//Match secret for security
if ($_GET['secret'] != $secret) {    return;} if ($status != 2) {  
//Only accept confirmed transactions  return ;}

$db = new SQLite3('payments_db.sqlite', SQLITE3_OPEN_READWRITE);
//Mark address in database as paid

$stmt = $db->prepare("UPDATE payments set addr=:addr,txid=:txid,".                        "value=:value where addr=:addr");
$stmt->bindParam(":addr", $addr);
$stmt->bindParam(":txid", $txid);
$stmt->bindParam(":value", $value);
$stmt->execute();

?>

Crypto currencies list

Return the list of accepted cryptocurrencies by bcon.global. Only BTC & BNB at the moment.

Definition

GET https://external-api.bcon.global/api/v1/currencies

Example Reques

curl https://external-api.bcon.global/api/v1/currencies

Example Response

{"status":"Ok","data":{"currencies":[{"id":1,"name":"BTC","iso_name":"btc"},{"id":3,"name":"BNB","iso_name":"bnb"}]}}

Rate to fiat currency

Definition

GET https://external-api.bcon.global/api/v1/currencies/{crypto currency name}?currency={fiat currency name} 

Example Request BTC

curl https://external-api.bcon.global/api/v1/currencies/btc?currency=eur

Example Request BNB

curl https://external-api.bcon.global/api/v1/currencies/bnb?currency=eur

Example Response

{"status":"Ok","data":{"price":"20324.000000000000000000"}}

Test Payment

You can test the flow of receiving a transaction without spending real money.

Login to the user panel, then go to the "Merchants > Test Payments" page and fill out the form for testing the appearance of a transaction. Or you can use the external api endpoint like below:

Definition

POST https://external-api.bcon.global/api/v1/test

Example Request

{"status":"confirmed","transaction_id":"ggw43tjio3jg3g3o4","sum":"0.000005","address":"1bc34t3grrr33","currency_id":1,"store_id":216}
  • status - (confirmed, partially_confirmed,unconfirmed)
  • transaction_id - txid (any string)
  • sum - sum of transaction
  • address - output address, required if store is btc
  • memo - required if store is bnb
  • currency_id - id of currencystore_id - id of store

Example Response

{"status":"Ok","data":{"message":"Test passed successfully!"}}

Bcon Global: API-Enabled Crypto Payment Solutions for Seamless Integration

Join Bcon Global’s revolutionary crypto payment platform, powered by our robust API that enables seamless integration and customization of payment solutions.

API-Enabled Crypto PaymentsWith Bcon Global’s API, you have the power to create your own payment solutions and plugins. Our flexible API allows you to tailor the payment experience to your specific needs, offering a truly customized solution for your business.

Diversify Payment Options
Expand your market reach and cater to a wider audience with Bcon Global’s support for major blockchains such as BTC and BNB. Give your customers the freedom to pay with their preferred cryptocurrencies, providing them with a convenient and versatile payment experience.

Real-time Monitoring and Support
Stay informed about the latest market trends and fluctuations with Bcon Global’s real-time monitoring capabilities. Our user-friendly dashboard empowers you with valuable insights, enabling you to make informed decisions for your crypto payment strategies. And rest assured, our dedicated support team is always ready to assist you along the way.

Experience the Future of Crypto Payments
Join Bcon Global today and unlock the potential of our API-enabled crypto payment solutions. Seamlessly integrate our platform into your existing systems, create tailored payment experiences, and revolutionize the way you transact in the world of cryptocurrencies. Embrace the future of efficient, secure, and customizable crypto transactions with Bcon Global.