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#
1
<?php
2
$secret = "7j0ap91o99cxj8k9";
3
$my_address = "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7";
4
$my_callback_url = "http://example.com/callback?invoice_id=1234&secret=" . $secret;
5
$api_base = "https://blockchainapi.org/api/eth";
6
7
$curl = curl_init();
8
curl_setopt_array($curl, array(
9
CURLOPT_RETURNTRANSFER => 1,
10
CURLOPT_URL => $api_base . "?method=create&address=" . $my_address . "&callback=" . $my_callback_url
11
));
12
13
$response = curl_exec($curl);
14
$http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
15
curl_close($curl);
16
17
if ($http_status_code == 200) {
18
19
$decoded = json_decode($response, true);
20
echo "Please send the payment to the following Ethereum address: " . $decoded["success"]["account"];
21
22
} else {
23
echo "Sorry, an error occurred";
24
}
25
?>
Copied!
1
# Importing the requests library
2
import requests
3
4
# Api-endpoint
5
URL = "https://blockchainapi.org/api/eth?method=create"
6
7
# Parameters
8
myAddress = "0x30Bf2f3bB0bE4C3b2B8B038A29161b885A0D5cc9"
9
mySecret = "7j0ap91o99cxj8k9"
10
myCallback = "http://example.com/callback?invoice_id=1234&secret=" + mySecret
11
12
# Defining a params dict for the parameters to be sent to the API
13
PARAMS = {'address':myAddress, 'callback':myCallback}
14
15
# Sending get request and saving the response as response object
16
r = requests.get(url = URL, params = PARAMS)
17
18
# Extracting data in json format
19
data = r.json()
20
21
# Extracting account customers pay to
22
send_to_address = data['success']['account']
23
24
# Printing the output
25
print("Please pay to the following address: %s\n"
26
%(send_to_address))
Copied!
1
const request = require('request');
2
const http = require('http');
3
4
// Define our custom values
5
var my_address = "0x30Bf2f3bB0bE4C3b2B8B038A29161b885A0D5cc9";
6
var my_secret = "H78SY8DIJIDAID8JHD";
7
var my_callback = "http://example.com/callback?invoice_id=1234&secret=" + my_secret;
8
9
// BlockchainAPI endpoint
10
let endpoint = 'https://blockchainapi.org/api/eth?method=create&address=' + my_address + "&callback=" + my_callback;
11
12
// Request options
13
let options = {json: true};
14
15
// Define server variables
16
var port = 8181;
17
var hostname = "localhost";
18
19
var account = "";
20
var destination = "";
21
var fee_percentage = "";
22
var callback_url = "";
23
var tor = "";
24
25
request(endpoint, options, (error, res, body) => {
26
27
if (error) {
28
return console.log(error)
29
};
30
31
if (!error && res.statusCode == 200) {
32
// do something with JSON, using the 'body' variable
33
var response = JSON.parse(JSON.stringify(body));
34
if(response.success) {
35
// Good, we managed to create an address
36
console.log('Good, we managed to get a success response');
37
38
// Now dig into the values
39
account = response.success.account;
40
destination = response.success.destination;
41
fee_percentage = response.success.fee_percent;
42
callback_url = response.success.callback_url;
43
tor = response.success.tor;
44
45
} else {
46
// Failed to get success response
47
console.log('Bad, failed to get success response');
48
}
49
};
50
});
51
52
// Initialise the server on port 8181
53
const server = http.createServer((req, res) => {
54
res.statusCode = 200;
55
res.setHeader('Content-type', 'text/html');
56
57
// Show the "Please send the payment to..."
58
if(account !== null) {
59
res.write('<p>Please send the payment to the following Ethereum address: ' + account + '</p>');
60
} else {
61
res.write('<p>Failed to create a new address to pay to</p>');
62
}
63
res.end('Page fully loaded');
64
});
65
66
server.listen(port, hostname, () => {
67
console.log(`Server running at http://${hostname}:${port}/`);
68
});
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
using Newtonsoft.Json;
5
6
public class Program
7
{
8
public static void Main()
9
{
10
string html = string.Empty;
11
string my_secret = "7j0ap91o99cxj8k9";
12
string my_callback = "http://example.com/callback?invoice_id=1234&secret=" + my_secret;
13
string my_address = "1LisLsZd3bx8U1NYzpNHqpo8Q6UCXKMJ4z";
14
string endpoint = @"https://blockchainapi.org/api/eth?method=create&address=" + my_address + "&callback=" + my_callback;
15
16
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(endpoint);
17
request.AutomaticDecompression = DecompressionMethods.GZip;
18
19
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
20
using (Stream stream = response.GetResponseStream())
21
using (StreamReader reader = new StreamReader(stream))
22
{
23
html = reader.ReadToEnd();
24
25
// Check if we found a success response
26
dynamic result = JsonConvert.DeserializeObject(html);
27
28
string account = result.success.account;
29
30
Console.Write("Send the payment to the following address: " + account);
31
}
32
}
33
}
Copied!
Last modified 3mo ago
Copy link