Advertisement
coinables

Blockchain Receive Payments API v2 Callback

Nov 27th, 2015
1,009
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. //implementing the callback file
  2.  
  3. $secret = "your_secret";
  4.  
  5. if($_GET['secret'] != $secret)
  6. {
  7.   die('Stop doing that');
  8. }
  9. else
  10. {
  11. //update DB
  12. $order_num = $_GET['invoice'];
  13. $amount = $_GET['value']; //default value is in satoshis
  14. //$amountCalc = $amount / 100000000; //optional convert to bitcoins
  15.    $queryUpdate = "UPDATE orders SET paid = 1, recd = $amount WHERE orderid = '$order_num'";
  16.    $doUpdate = mysqli_query($conn, $queryUpdate) or die(mysqli_error($conn));
  17.    echo "*ok*"; // you must echo *ok* on the page or blockchain will keep sending callback requests every block up to 1,000 times!
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement