For Developers

IP address of IPN notifications: 185.161.211.251

ACCEPTING PAYMENTS

To start accepting payments on your site, you first need to register, create an application in your account, receive a secret key and a token in the application settings.

Getting an address

To receive a one-time bitcoin address, send a GET request to the following address: https://apibtc.com/api/create_address?token=TOKEN&callback=URL_RESULT

TOKEN: Token allows you to interact with the wallet of the application. It is found in the application settings

URL_RESULT: Your URL address, where we will be sending you payment notifications. We will continue to send payment notifications for 6 confirmations in the bitcoin network.

Note! The reverse URL should be accessible via HTTPS

PHP example:


   $my_callback_url = urlencode("https://YOUSITE.COM/confirm?ID=".$payment_id."&");
   $url = "https://apibtc.com/api/create_wallet?token=TOKEN&callback=".$my_callback_url;
   $json = file_get_contents($url);
   $res = json_decode($json, true);
   if($res["success"]){
        $sign = md5($res["Res"]["Address"].ACCESS_KEY);
        if($sign == $res["Res"]["Sign"]){
            //Send the form
            // $res["Res"]["Address"] - Wallet for the user to transfer money
        }
   }
							

ACCESS_KEY: A secret key used to verify the validity of the data received. It is found in the application settings

Our server's response:

    {
    "success":true,
    "Res":
            {
            "Sign":"69a3581c3ddd3ad441bbff5d23d0dbfd",
            "Address":"13sNWa1CLxRAXq1jj2yinQc7mDVbdEQjsN",
            "DateEnd":"2017-02-27 10:20:23"
            }
    }
                            

Form for redirecting the user to the merchant:   


    <form method="POST" action="https://apibtc.com/merchant/invoice">
        <input type="hidden" name="wallet" value="<?php=$res["Res"]["Address"]?>">
        <input type="hidden" name="return_user" value="URL_RETURN_USER">
        <input type="hidden" name="amount" value="0.01">
        <button type="submit">Go to the merchant</button>
    </form>
							

URL_RETURN_USER: URL of user redirect after payment

Payment notification

After payment, our server will send POST notifications to the URL address you specified earlier (URL_RESULT). The notifications will contain the following data:


    "amount" => "0.0002",
    "confirmations" => "2",
    "address" => "1MAqYeQutjyLMoF9UP95K1vjcgp72xLPsp",
    "txid" => "f12c1c857019e1fe447772dbc52187208d8063b977360d31511eecb71df67184",
    "time" => "1445340746",
    "apibtc_id" => "61",
    "hash" => "md5(ACCESS_KEY.TXID.APIBTC_ID.ADDRESS)"
							

Payment processing

You have to process the payment and let us know whether you have received it. The processing processor should always return a response for the transaction ID in your system, as described in the example below. Both fields are required! Both fields are required!

Your server's expected response:


	Successfully|23432463

PHP example:


    // Verification of received data
    if($_POST["hash"] == md5(ACCESS_KEY.$_POST["txid"].$_POST["apibtc_id"].$_POST
    ["address"])){

            // Update the payment information in the database

            $msg = "Successfully|".PAYMENT_ID;
                  
            echo $msg;
    }
							

ACCESS_KEY: A secret key used to verify the validity of the data received. It is found in the application settings

PAYMENT_ID: Payment ID in your system

Balance

Get the current balance in your wallet. Please note that you will receive the balance of your wallet with confirmed transactions.

Send a GET request to our server at the following address:
https://apibtc.com/api/get_balance?token=TOKEN

Our server's response:


    {
    "success": true,
    "balance":0.00000000
    }
						

In addition, you can get a balance and the total amount of funds received at a particular address

Send a GET request to our server at the following address: https://apibtc.com/api/get_address_balance?token=TOKEN&address=ADDRESS

Our server's response:


    {
    "success":true,
    "balance":0.0002006,
    "received":0.01098067
    }
						

Sending payments

Make payment

Send a GET request to our server at the following address:
https://apibtc.com/api/sendmoney/?token=TOKEN&wallet=WALLET TO SEND&amount=SUMM SEND

After successful payment, return transaction hash and the balance after payment

Make multiple payments

You need to send JSON POST request to https://apibtc.com/api/multisendmoney
Don't forget to specify the HTTP Content-type header: "application/json".

Example of JSON structure


    {
    "token": "TOKEN",
    "outputs": [
        {"address": "ADDDRESS_1", "amount": AMOUNT_IN_BTC},
        {"address": "ADDDRESS_2", "amount": AMOUNT_IN_BTC},
        ...
        ]
    }
							

Example for command line curl:


    curl -H "Content-Type: application/json" -X POST -d
    '{ "token": "TOKEN","outputs": [
        {"address": "ADDRESS_1", "amount": AMOUNT_IN_BTC},
        {"address": "ADDRESS_2", "amount": AMOUNT_IN_BTC}
    ]}'
    https://apibtc.com/api/multisendmoney
							

Our server's response:


    {
    "success": true,
    "Res": {
         "tx": "hash",
         "commission": 0,
         "balance": 0
        }
    }
							

IN ADDITION

Transaction history

Getting the transaction list!

start - (int) with a sample recording start

count - (int) how to choose

Send a GET request to our server at the following address:
https://apibtc.com/api/get_transaction?token=TOKEN&start=START&count=COUNT

Our server's response:


    [{
        txid : "31b523b53286a4e1f330220958fd42e0898ffb751a5ba6b8d03221c458b0e63a",
        confirmed : 10,
        time : "2017-07-03 09:22:54",
        type : 1,
        apibtc_id : 44,
        amount : 12300000,
        callback : "http://httpbin.org/post",
        server_response : "...",
        address : "mw4NZA1rWM7RWkXW76epnfbwyhML7vX6cH"
    }]
							

Total number of transactions

Send a GET request to our server at the following address: https://apibtc.com/api/get_count_transaction?token=TOKEN

Our server's response:


    {
    "success":true,
    "count":"2"
    }
							

Address validation

Send a GET request to our server at the following address:
https://apibtc.com/api/validateaddress?token=TOKEN&address=ADDRESS

Our server's response:


    {
    "status": true
    }
							

Checking the commission of the transaction

Send a GET request to our server at the following address:
https://apibtc.com/api/check_transaction_fee?token=TOKEN&address=ADDRESS&amount=AMOUNT_BTC

Our server's response:


    {
    "success":true,
    "fee":10000
	}