Search…
Generate Address's
The create method of the receive endpoint generates a unique Ethereum address to which the customer may send payments.

NOTE

You can only send ONE payment to each generated Ethereum address!

Anymore than ONE payment WILL NOT be detected!

The Ethereum network uses large fees to process transactions as transactions cancel on their own if not found within a short period of time. It is advised to only use Ethereum for larger payments starting at $500 or above.
get
https://blockchainapi.org
/api/eth?method=create
The following block shows an example of the request URL:
Note: make sure you place your callback URL last or it will not set correctly

Example code

PHP
Python
Node JS
C#
<?php
$secret = "7j0ap91o99cxj8k9";
$my_address = "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7";
$my_callback_url = "http://example.com/callback?invoice_id=1234&secret=" . $secret;
$api_base = "https://blockchainapi.org/api/eth";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $api_base . "?method=create&address=" . $my_address . "&callback=" . $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 Ethereum address: " . $decoded["success"]["account"];
} else {
echo "Sorry, an error occurred";
}
?>
# Importing the requests library
import requests
# Api-endpoint
URL = "https://blockchainapi.org/api/eth?method=create"
# Parameters
myAddress = "0x30Bf2f3bB0bE4C3b2B8B038A29161b885A0D5cc9"
mySecret = "7j0ap91o99cxj8k9"
myCallback = "http://example.com/callback?invoice_id=1234&secret=" + mySecret
# Defining a params dict for the parameters to be sent to the API
PARAMS = {'address':myAddress, 'callback':myCallback}
# Sending get request and saving the response as response object
r = requests.get(url = URL, params = PARAMS)
# Extracting data in json format
data = r.json()
# Extracting account customers pay to
send_to_address = data['success']['account']
# Printing the output
print("Please pay to the following address: %s\n"
%(send_to_address))
const request = require('request');
const http = require('http');
// Define our custom values
var my_address = "0x30Bf2f3bB0bE4C3b2B8B038A29161b885A0D5cc9";
var my_secret = "H78SY8DIJIDAID8JHD";
var my_callback = "http://example.com/callback?invoice_id=1234&secret=" + my_secret;
// BlockchainAPI endpoint
let endpoint = 'https://blockchainapi.org/api/eth?method=create&address=' + my_address + "&callback=" + my_callback;
// Request options
let options = {json: true};
// Define server variables
var port = 8181;
var hostname = "localhost";
var account = "";
var destination = "";
var fee_percentage = "";
var callback_url = "";
var tor = "";
request(endpoint, options, (error, res, body) => {
if (error) {
return console.log(error)
};
if (!error && res.statusCode == 200) {
// do something with JSON, using the 'body' variable
var response = JSON.parse(JSON.stringify(body));
if(response.success) {
// Good, we managed to create an address
console.log('Good, we managed to get a success response');
// Now dig into the values
account = response.success.account;
destination = response.success.destination;
fee_percentage = response.success.fee_percent;
callback_url = response.success.callback_url;
tor = response.success.tor;
} else {
// Failed to get success response
console.log('Bad, failed to get success response');
}
};
});
// Initialise the server on port 8181
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-type', 'text/html');
// Show the "Please send the payment to..."
if(account !== null) {
res.write('<p>Please send the payment to the following Ethereum address: ' + account + '</p>');
} else {
res.write('<p>Failed to create a new address to pay to</p>');
}
res.end('Page fully loaded');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
using System;
using System.Net;
using System.IO;
using Newtonsoft.Json;
public class Program
{
public static void Main()
{
string html = string.Empty;
string my_secret = "7j0ap91o99cxj8k9";
string my_callback = "http://example.com/callback?invoice_id=1234&secret=" + my_secret;
string my_address = "1LisLsZd3bx8U1NYzpNHqpo8Q6UCXKMJ4z";
string endpoint = @"https://blockchainapi.org/api/eth?method=create&address=" + my_address + "&callback=" + my_callback;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(endpoint);
request.AutomaticDecompression = DecompressionMethods.GZip;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
html = reader.ReadToEnd();
// Check if we found a success response
dynamic result = JsonConvert.DeserializeObject(html);
string account = result.success.account;
Console.Write("Send the payment to the following address: " + account);
}
}
}
Copy link