IPN (Instant Payment Notification)
The payment process and confirmation of transaction may take from several minutes to several hours. Our service will notify you about confirmation by sending a POST request with data to the status URL you specified. The notification will occur after the transaction: appears on the network in mempool (only for outcoming = 0 confirmation), included to block (1st confirmation) and after its 12th confirmation.
Data in JSON format:
type: message type = (in-payment / track-tracking / out-sending)
date: date and time in UNIX format
token: token = (only for token transaction, ERC20 token ID)
fee: fee (only for confirmed transaction)
txid: transaction txid (hash)
confirmations: number of confirmations = (0 - pending / 1 / 12)
sign2: signature version 2
To verify the signature, you must calculate a hash from the received data and compare it with the value in the sign or sign2 field.
A hash is a (40-character hexadecimal number) result of the sha1 function from the string received by connecting through the colon (:) the values of the type, date, from, to, [token,] amount, txid, confirmations, tag and API key.
The service expects a text response from the IPN handler.
This text can be seen in the office on the "Notifications" tab.
PHP IPN Handler Code Example:
$_POST = @json_decode(file_get_contents('php://input'), true);
$tosign = array(
$cfg['apikey'] // API access key
$sign2 = sha1(implode(':', $tosign)); // sign v2 always includes token
unset($tosign); // exclude from old sign for non-token transaction
$sign = sha1(implode(':', $tosign));
if ($sign !== $_POST['sign']) // or if ($sign2 !== $_POST['sign2'])
die('Sign wrong'); // this answer will be visible in the dashboard
Signature version 2 always includes the $_POST['token'] even if it is empty or not set. You can use ANY of these signatures.
Notifications come from IP = 184.108.40.206