You are on page 1of 2

{"address":"19jJyiC6DnKyKvPg38eBE8R6yCSXLLEjqw","index":23,"callback":"https://myst

ore.com?invoice_id=058921123"}

curl "https://api.blockchain.info/v2/receive?
xpub=xpub6CWiJoiwxPQni3DFbrQNHWq8kwrL2J1HuBN7zm4xKPCZRmEshc7Dojz4zMah7E4o2GEEbD6Hgf
G7sQid186Fw9x9akMNKw2mu1PjqacTJB2&callback=https%3A%2F%2Fmystore.com%3Finvoice_id
%3D058921123&key=[yourkeyhere]"

$secret = 'ZzsMLGKe162CfA5EcG6j';
$my_xpub = '{YOUR XPUB ADDRESS}';
$my_api_key = '{YOUR API KEY}';

$my_callback_url = 'https://mystore.com?invoice_id=058921123&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);

$receive = "1EWRUEGseiF6hb36HM9JDRABxQZtzm3t7i";

$object = json_decode($response);

echo 'Send Payment To : ' . $object->address;

curl -H "Content-Type: text/plain" --data '{"key":"[your-key-


here]","addr":"183qrMGHzMstARRh2rVoRepAd919sGgMHB",
"callback":"https://mystore.com?
invoice_id=123","onNotification":"KEEP","op":"RECEIVE",
"confs":5}'

https://api.blockchain.info/v2/receive/balance_update

$real_secret = 'ZzsMLGKe162CfA5EcG6j';
$invoice_id = $_GET['invoice_id'];
$transaction_hash = $_GET['transaction_hash'];
$value_in_satoshi = $_GET['value'];
$value_in_btc = $value_in_satoshi / 100000000;

if($_GET['test'] == true){ return; }

try{
$database = new SQLiteDatabase ('db.sqlite',0666,$error);
}
catch(Exception $e)
{
die($error); }

$stmt = $db->prepare("replace INTO


invoice_payments(invoice_id,transaction_hash,value)values(?,?,?)");
$stmt->bind_param("isd",$invoice_id,$transaction_hash,$value_in_btc);

if($stmt->execute()){

echo "*ok*";
}
Expected Callback

You might also like