Bitcoin forwarding API

V 1.0

Contents

This function generates a unique bitcoin address to which the customer may send payments. This address is infinite without transactions limits.

You can generate bitcoin addresses for one-time payments or for periodic payments as a linked bitcoin address to a user account. For example, if a customer re-uses it to buy the same product again or to top up the account balance with bitcoins.

Generated addresses never expire. Will be permanently monitored.

Please note that micropayments are not efficient in bitcoin network because of high network fee.

HTTP and HTTPS protocol schemas in URL are required. Also, we support callback to TOR project logo network.

As the destination address, you can indicate any type of bitcoin addresses that exists at the moment: standard addresses starting with "1" (P2PKH); Pay to Script Hash addresses with the SegWit support (P2SH-P2WPKH), starting with "3"; as well as new SegWit addresses starting with "bc" (P2WPKH).

 

Simple requests:

Code Example

<?php
  $my_address = "bc1qggg2ys8duv4qvnfgzng2p75m6ehklcmfygr9m4";
  $my_callback_url = "http://example.com/callback?invoice_id=1234&secret=7j0ap91o99cxj8k9";
  $api_base = "https://apirone.com/api/v1/receive";
 
  $curl = curl_init();
  curl_setopt_array($curl, array(
      CURLOPT_RETURNTRANSFER =< 1,
      CURLOPT_URL =< $api_base . "?method=create&address=" . $my_address .
		"&callback=" . urlencode($my_callback_url)
  ));
  $response = curl_exec($curl);
  $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  curl_close($curl);
 
  if ($http_status_code == 200) {
      $decoded = json_decode($response, true);
      echo "Please send the payment to the following bitcoin address: " .
			$decoded["input_address"];
  } else {
      echo "Sorry, an error occurred: " . $response;
  }
?>
<?php
  $my_address = "bc1qggg2ys8duv4qvnfgzng2p75m6ehklcmfygr9m4";
  $my_callback_url = 
  		urlencode("http://example.com/callback?invoice_id=1234&secret=7j0ap91o99cxj8k9");
  $data = file_get_contents("https://apirone.com/api/v1/receive?method=create&address=". 
  		$my_address. "&callback=" . $my_callback_url);
  $respond = json_decode($data,true);
  $address = $respond["input_address"]; // bitcoin address for customer payments
  echo $address;
?>
import requests
import urllib
my_address = 'bc1qggg2ys8duv4qvnfgzng2p75m6ehklcmfygr9m4'
my_callback_url = urllib.parse.urlencode({"r":"http://example.com/callback?invoice_id=1234&secret=7j0ap91o99cxj8k9"})[2:]
url = 'https://apirone.com/api/v1/receive?method=create&address=%s&callback=%s' % (my_address, my_callback_url)
response = requests.get(url)
print(response.text)
Method and Variables:
Parameter Description Required Experiment with a value
method=create

This method generates a new deposit address

Required
{address}
base58,
32 chars

Destination address
Your destination bitcoin address where confirmed payments will be forwarded

Required
{callback}
text,
=< 1024 chars

Callback URL')}}
Your server's callback URL to receive data about the payment. You can add any optional GET parameters. This must be a valid URL.
Callback URL should be url encoded or attached at the end of query. Otherwise it will return an error.

Required
  Reset Values Send request
Response from server:
{ "fee_percent": 1, "destination": "bc1qggg2ys8duv4qvnfgzng2p75m6ehklcmfygr9m4", "input_address": "1FEGJSLDJJ6oSuJwur3fCD7TtQbYUjBV4z", "callback_url": "http://example.com/addbalance.php?user=118" }

Success Response

Success response returns four parameters in JSON format:
Parameter Description Type (length)
{fee_percent} Percentage that is taken as a service fee. Default: 1 integer
{destination} Merchant's destination (a bitcoin address) where confirmed payments will be forwarded base58 (32 chars)
{input_address} The generated bitcoin address to receive a payment from a customer. base58 (32 chars)
{callback_url} Your server callback URL to receive data about the payment. text (max. 1024 chars)
Response example:
{
    "destination": "bc1qggg2ys8duv4qvnfgzng2p75m6ehklcmfygr9m4",
    "input_address": "1FEGJSLDJJ6oSuJwur3fCD7TtQbYUjBV4z",
    "callback_url": "http://example.com/callback?invoice_id=1234&secret=7j0ap91o99cxj8k9"
}

Error Response

Error response return messages in plain text format below:
The supplied address is not a valid bitcoin address.
The supplied callback URL is not valid.
Wrong method.
Not enough parameters.
Incorrect address type.