user112408: I'm trying to add bitcoin payment for my ecommerce website. I have installed bitcoind on the server and i've set the notify wallet parameter in bitcoin.conf. the issue i have now is how to know that the client have sent the exact needed amount for products they bought.
Actually, the client can send a lower amount to my wallet and notify wallet will be generated. Please help to handle this issue.

user41313: If you insist on using bitcoind directly, you could always use the gettransaction rpc call to get transaction info on that transaction.
Hopefully you're using xpubs or at least a list of pre-imported addresses, and not using that bitcoind to manage your wallet/generate new addresses itself though. You shouldn't keep your private key on the live bitcoind node connected to your public ecommerce site.

user26873: Walletnotify needs to be defined in your bitcoin.conf file,
example:
walletnotify = /usr/bin/php some/path/newdeposit.php?tx=%s    

In the above example every time there is a new transaction on your wallet, the newdeposit.php script will run and the transaction ID will be stored in a GET named "tx".
Then we can pull the transaction id from the tx GET and put it through a gettransaction command.
$tx = $_GET['tx'];
$getTrans = $bitcoin->gettransaction($tx);

From there we need to look through the API response, see if it has at least once confirmation, and how much was sent. We'll do this by running a loop, checking for the "receive" category. If there is a match you can do whatever you want in your database.
$confirmations = $getTrans["confirmations"];

if($confirmations < 1){
die();

} else {
 $countDetails = count($getTrans['details']);
 for($i=0;$i<$countDetails;$i++){
   $getAddress = $getTrans['details'][$i]['address'];
   $getReceive = $getTrans['details'][$i]['category'];
  
   if($getAddress == $myAddress && $getReceive == "receive"){
    $amount = $getTrans['details'][$i]['amount'];
    $amount = $amount * 100000000;
    //do something with $amount
   }

 }
 
}

Walletnotify only fires twice. Once when the transaction first appears on the network, and a second time after it has been included in a block(one confirmation).
Don't forget to multiply the amount by 100 million to turn it into satoshis so you're not working with floats.

112408: <p>I'm trying to add bitcoin payment for my ecommerce website. I have installed bitcoind on the server and i've set the notify wallet parameter in bitcoin.conf. the issue i have now is how to know that the client have sent the exact needed amount for products they bought.</p>
<p>Actually, the client can send a lower amount to my wallet and notify wallet will be generated. Please help to handle this issue.</p>
 41313: <p>If you insist on using bitcoind directly, you could always use the gettransaction rpc call to get transaction info on that transaction.</p>
<p>Hopefully you're using xpubs or at least a list of pre-imported addresses, and not using that bitcoind to manage your wallet/generate new addresses itself though. You shouldn't keep your private key on the live bitcoind node connected to your public ecommerce site.</p>
 26873: <p>Walletnotify needs to be defined in your bitcoin.conf file,
example:</p>
<pre><code>walletnotify = /usr/bin/php some/path/newdeposit.php?tx=%s    
</code></pre>
<p>In the above example every time there is a new transaction on your wallet, the newdeposit.php script will run and the transaction ID will be stored in a GET named &quot;tx&quot;.</p>
<p>Then we can pull the transaction id from the tx GET and put it through a <code>gettransaction</code> command.</p>
<pre><code>$tx = $_GET['tx'];
$getTrans = $bitcoin-&gt;gettransaction($tx);
</code></pre>
<p>From there we need to look through the API response, see if it has at least once confirmation, and how much was sent. We'll do this by running a loop, checking for the &quot;receive&quot; category. If there is a match you can do whatever you want in your database.</p>
<pre><code>$confirmations = $getTrans[&quot;confirmations&quot;];

if($confirmations &lt; 1){
die();

} else {
 $countDetails = count($getTrans['details']);
 for($i=0;$i&lt;$countDetails;$i++){
   $getAddress = $getTrans['details'][$i]['address'];
   $getReceive = $getTrans['details'][$i]['category'];
  
   if($getAddress == $myAddress &amp;&amp; $getReceive == &quot;receive&quot;){
    $amount = $getTrans['details'][$i]['amount'];
    $amount = $amount * 100000000;
    //do something with $amount
   }

 }
 
}
</code></pre>
<p>Walletnotify only fires twice. Once when the transaction first appears on the network, and a second time after it has been included in a block(one confirmation).</p>
<p>Don't forget to multiply the amount by 100 million to turn it into satoshis so you're not working with floats.</p>
