Receiving Callbacks
You'll need some server-side code to handle the callbacks sent by our system when a payment is detected.
As mentioned before, each time a payment is received and forwarded to your Ethereum address, your callback URL will be sent data about the payment. This is necessary for automated systems to know when a specific payment is sent. Our server will forward the payments and send these callbacks to your server immediately after payments are received and confirmed 1 times. After this, every time the confirmations value changes, we will send another callback, up to 20 confirmations or 20 bad callback requests.
Callbacks will always be sent as POST requests containing the details of the payment and the forwarded transaction, in addition to any parameters already present in the callback URL. Once again, please recall that callback URLs have a maximum length of 1024 characters.
Remember that for security, you should make sure that you include a unique, secret parameter in your callback URL. This secret string will be passed back to the callback script when the callback is sent, along with any other parameters already present in the callback URL. It should be checked against the original secret string to ensure that the callback is coming from us and is not forged.
Receive callback data
Do not POST this to us. This is the information we POST to your callback URL.

Example code

The following code will check that 12 confirmations have passed.
// Payment Settings
$my_address = "0xd85f18d58982db82e1916d84bc9ecec2a6e93d45"; // Your destination address
$desiredConfirmations = 12;
// If you're using a secret, put it in here
$secret = "7j0ap91o99cxj8k9";
// Start of checks
if(!isset($_GET['secret'])) {
die('No secret found.');
if ($_GET["secret"] !== $secret) die();
// Make sure we have all the POST variables we want to get
if(!$_POST['input_address'] || !$_POST['input_transaction_hash'] || !$_POST['transaction_hash'] || !$_POST['valueWEI'] || !$_POST['gas'] || !$_POST['gasPrice'] || !$_POST['valueETH'] || !$_POST['confirmations'] || !$_POST['destination_address']) {
die('One of more of the POST variables was not set in the request to our callback url.');
if ($_POST["destination_address"] !== $my_address) die();
$gas = $_POST["gas"];
$gasPrice = $_POST["gasPrice"];
$value_in_eth = $_POST["valueETH"];
$value_in_wei = $_POST["valueWEI"];
$transaction_fee = ($gasPrice * $gas); // Transaction fee in WEI
$input_address = $_POST["input_address"];
$input_transaction_hash = $_POST["input_transaction_hash"];
$transaction_hash = $_POST["transaction_hash"];
$confirmations = $_POST["confirmations"];
// Work out the real amount they sent to the our address
$totalSent = bcsub($value_in_wei, $transaction_fee); // Use BCMath extension to use this - it's for huge/large numbers that do not fit into 32bit
// Confirmation check to make sure the confirmations is above our desired amount
if($confirmations >= $desiredConfirmations) {
// Insert your data into a database so you can later on, fetch that data and update it
// {{ Do you magic here }}
} else {
// Transaction has not reached our desired number of confirmations.
// Keep waiting for confirmations to be larger
Copy link
On this page
Receive callback data
Example code