Bitcoin Forum
August 20, 2024, 04:15:43 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how change number of confirmation in API? [bc.i]  (Read 788 times)
f4t4l (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


Presale Starting May 1st


View Profile
December 13, 2014, 06:38:29 AM
Last edit: December 13, 2014, 05:36:32 PM by gmaxwell
 #1

im using this api https://blockchain.info/api for receive payments, i think confirmaton set for 6 confirm.thats correct?
i want change it to 1 confirmation. how? Smiley

Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
December 13, 2014, 07:08:17 AM
 #2

im using this api https://blockchain.info/api for receive payments, i think confirmaton set for 6 confirm.thats correct?
i want change it to 1 confirmation. how? Smiley


Read https://blockchain.info/api/api_receive .

Quote from: blockchain.info/api/api_receive
Parameters:
  • value  --  The value of the payment received in satoshi. Divide by 100000000 to get the value in BTC.
  • input_address  --  The bitcoin address that received the transaction.
  • confirmations  --  The number of confirmations of this transaction.
  • {Custom Parameters}  --  Any parameters included in the callback URL will be passed back to the callback URL in the notification.
  • transaction_hash  --  The transaction hash.
  • input_transaction_hash  --  The original paying in hash before forwarding.
  • destination_address  --  The destination bitcoin address. Check this matches your address.

From blockchain.info/api/api_receive :

Code:
if ($_GET['confirmations'] >= 6) {
    //Insert into confirmed payments
    echo '*ok*';
} else {
    //Insert into pending payments
    //Don't print *ok* so the notification resent again on next confirmation
}


   ~~MZ~~

f4t4l (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


Presale Starting May 1st


View Profile
December 13, 2014, 07:20:17 AM
 #3

im using this api https://blockchain.info/api for receive payments, i think confirmaton set for 6 confirm.thats correct?
i want change it to 1 confirmation. how? Smiley


Read https://blockchain.info/api/api_receive .

Quote from: blockchain.info/api/api_receive
Parameters:
  • value  --  The value of the payment received in satoshi. Divide by 100000000 to get the value in BTC.
  • input_address  --  The bitcoin address that received the transaction.
  • confirmations  --  The number of confirmations of this transaction.
  • {Custom Parameters}  --  Any parameters included in the callback URL will be passed back to the callback URL in the notification.
  • transaction_hash  --  The transaction hash.
  • input_transaction_hash  --  The original paying in hash before forwarding.
  • destination_address  --  The destination bitcoin address. Check this matches your address.

From blockchain.info/api/api_receive :

Code:
if ($_GET['confirmations'] >= 6) {
    //Insert into confirmed payments
    echo '*ok*';
} else {
    //Insert into pending payments
    //Don't print *ok* so the notification resent again on next confirmation
}


   ~~MZ~~
thank you. still not working!

f4t4l (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


Presale Starting May 1st


View Profile
December 13, 2014, 07:24:32 AM
 #4

i want when blockchain generate new address  for buyer,blockchain send all request at 1 confirmation,

Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
December 13, 2014, 07:51:28 AM
 #5

i want when blockchain generate new address  for buyer,blockchain send all request at 1 confirmation,

I didn't get you exactly. Can you elaborate please? Smiley

BTW, did you check the github repo? PHP : https://github.com/blockchain/receive_payment_php_demo and JAVA : https://github.com/blockchain/receive_payment_java .

   ~~MZ~~

f4t4l (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


Presale Starting May 1st


View Profile
December 13, 2014, 07:59:10 AM
 #6

i want when blockchain generate new address  for buyer,blockchain send all request at 1 confirmation,

I didn't get you exactly. Can you elaborate please? Smiley

BTW, did you check the github repo? PHP : https://github.com/blockchain/receive_payment_php_demo and JAVA : https://github.com/blockchain/receive_payment_java .

   ~~MZ~~
yes i checked it, but all transaction needs more than 1 confirmation. i want callback url done with 1 confirmation,

Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
December 13, 2014, 08:58:59 AM
 #7

yes i checked it, but all transaction needs more than 1 confirmation. i want callback url done with 1 confirmation,

PHP example from github repo (https://github.com/blockchain/receive_payment_php_demo/blob/master/callback.php):

Code:
<?php
include 'include.php';
mysql_connect($mysql_host$mysql_username$mysql_password) or die(__LINE__ ' Invalid connect: ' mysql_error());
mysql_select_db($mysql_database) or die( "Unable to select database. Run setup first.");
$invoice_id $_GET['invoice_id'];
$transaction_hash $_GET['transaction_hash'];
$value_in_btc $_GET['value'] / 100000000;
//Commented out to test, uncomment when live
if ($_GET['test'] == true) {
  echo 
'Ignoring Test Callback';
  return;
}
if (
$_GET['address'] != $my_bitcoin_address) {
    echo 
'Incorrect Receiving Address';
  return;
}
if (
$_GET['secret'] != $secret) {
  echo 
'Invalid Secret';
  return;
}
if (
$_GET['confirmations'] >= 4) {
  
//Add the invoice to the database
  
$result mysql_query("replace INTO invoice_payments (invoice_id, transaction_hash, value) values($invoice_id, '$transaction_hash', $value_in_btc)");
  
//Delete from pending
  
mysql_query("delete from pending_invoice_payments where invoice_id = $invoice_id limit 1");
  if(
$result) {
   echo "*ok*";
  }
} else {
   
//Waiting for confirmations
   //create a pending payment entry
   
mysql_query("replace INTO pending_invoice_payments (invoice_id, transaction_hash, value) values($invoice_id, '$transaction_hash', $value_in_btc)");
   echo 
"Waiting for confirmations";
}
?>


In the above code, you can see if ($_GET['confirmations'] >= 4), change 4 to 1 and try it. Smiley

P.S. After a small checking, I think if ($_GET['confirmations'] >= 1) will do it. Cheesy

   ~~MZ~~

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!