Skip to content

Instantly share code, notes, and snippets.

@serhack
Created July 15, 2017 12:49
Show Gist options
  • Save serhack/0851a17470ce0599b7e30075e685927c to your computer and use it in GitHub Desktop.
Save serhack/0851a17470ce0599b7e30075e685927c to your computer and use it in GitHub Desktop.
Monero
<?php
fucntion Verify_Payment($addresso, $paymentid){
$balance_method = $this->_run('getbalance');
$balance = $balance_method['balance'];
$height_method = $this->_run('getheight');
$height = $height_method['height'];
$payment_id = $paymentid; //Payment ID
$address = $addresso;
$get_bulk_params = array('payment_ids' => array($payment_id), 'min_block_height' => $height);
$get_bulk_methods = $this->_run('get_bulk_payments', $get_bulk_params);
if( $get_bulk_methods['payments']['payment_id'] == $payment_id && $get_bulks_methods['payments']['amount'] >= $amount){
$transaction_hash = $get_bulk_methods['payments']['tx_hash'];
$transaction_height = $get_bulk_methods['payments']['block_height'];
$confermations = $height - $transaction_height;
if($height < ($transaction_height + $confermations)){
echo "Payment has been received. We need a confirm from system.";
}
if($height >= ($transaction_heigh + $confermations)){
echo "Payment has been received and confirmed. Thanks!";
}
if(){}
$paid = true;
// Email merchant
// Notify him that someone transfer a payment
return $transaction_hash;
}
else{
echo "There was an error with checking payment";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment