I have decided to use blockcahin.info API for payment integration. I created a php to generate new address to send the BTC to. But this new generated address is not showing in my blockchain.info wallet. Is this normal?
Here are the codes for the two :
New address Generator :
<?php
$secret = 'abc';
$my_xpub = 'xpub123';
$my_api_key = 'api123';
$my_callback_url = 'http://yoyobtcrotator.cf/callback.php?&secret='.$secret;
$root_url = 'https://api.blockchain.info/v2/receive';
$parameters = 'xpub=' .$my_xpub. '&callback=' .urlencode($my_callback_url). '&key=' .$my_api_key;
$response = file_get_contents($root_url . '?' . $parameters);
$object = json_decode($response);
echo 'Send Payment To : ' . $object->address;
?>
Callback.php :
<?php
$real_secret = 'abc';
$transaction_hash = $_GET['transaction_hash'];
$value_in_satoshi = $_GET['value'];
$value_in_btc = $value_in_satoshi / 100000000;
if ($_GET['test'] == true) {
return;
}
if ($_GET['confirmations'] >= 1 && $_GET['value'] >=10000) {
echo '*ok*';
} else {
}
?>
The secret, api, xpub are imaginary.
Working : New address is generated for each user, the user needs to pay 10k or above and the callback.php displays *ok*.
Are these codes correct ?