Address

This function generates an unique bitcoin or litecoin address to which the customer may send payments. This address works without an expiry date or transaction limit.

Contents

You can generate bitcoin or litecoin 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.

Request:

JSON Schema description

Use POST string request containing the object in JSON format.

{WalletID} Wallet Identificator Required
Callback URL

Callback is an array of callback URL and user's Data parameters.

{callback:url}
string,
=< 1024 chars

Callback URL
Your server's callback URL to receive data about the payment. This must be a valid URL.

Optional
{callback:data}
array

Data
The associative array is based on key-value pairs. You can use as additional identification or secure a generated bitcoin address.

For example 'secret' = '7j0ap91o99cxj8k9' or 'invoice_id'='1234'

Optional

Request example:
{
   "callback":{                    #Callback and Callback's Data are Optional fields
      "url",
      "data":{
         "invoice_id": 1234,
         "secret": "7j0ap91o99cxj8k9",
         "data3": "text3",
		 ... #any user parameters
      }
   }
}

Success Response Reference:

Success response returns next parameters in JSON format:
{address} The generated bitcoin address to receive a payment from a customer. string, 32 chars
{callback} Your server callback URL to receive data about the payment. string, max. 1024 chars
{type} Type of address. string
{currency} Cryptocurrency: btc, ltc string
Response example:
{
   "callback":{
      "url":"http://example.com/callback",
      "data":{
         "invoice_id":1234,
         "secret":"7j0ap91o99cxj8k9"
      }
   },
   "address": "1FEGJSLDJJ6oSuJwur3fCD7TtQbYUjBV4z",
   "type": "p2sh-p2wpkh",
   "currency": "btc"
}

Error Response

Playground and Code examples:

Wallet ID
Callback URL KeyValue

+

{
   "callback":{
      "url" :  "http://example.com/callback"
   }
}
  
<?php
  $json_data = array (
    "callback" => array(
        'url'=> 'http://example.com/callback',
		'data'=> array (
            'invoice_id'=> "1234",
            'secret'=> "7j0ap91o99cxj8k9"
        )
    )
  );
  
  $wallet = "1aee83487b65b690305201fb4b42a081";
  $api_base = "https://apirone.com/api/v2/wallet/". $wallet ."/address";
 
  $curl = curl_init($api_base);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($json_data));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  $response = curl_exec($curl);
  curl_close($curl);
 

  $decoded = json_decode($response, true);
  echo "Please send the payment to the following bitcoin address: " .
  $decoded["address"];
?>
Send request
Response from server: