Author

Topic: blockchain.info payment API problem (Read 1581 times)

newbie
Activity: 7
Merit: 0
October 24, 2014, 12:25:11 AM
#6
Hi,
i had alot of problems with this Bitcoin API too, specialy the callback URL
after 2 nights of Headaches,i finaly found the problem :p
this is a DEMO, who is interesting to integrate this LOVELY API on his website he can "Check before Buy" here is the link : http://ex-currency.com/btc/index.php
Payment Sent/Recieved/Confirmed IMMEDIATLY
the price of curiosity is 1 USD
member
Activity: 67
Merit: 42
January 03, 2014, 01:06:24 AM
#5
Reeealy late reply,

But I had not seen the info about the new parameters. That's great!

Just wanted to say thanks!

// Mikael
hero member
Activity: 910
Merit: 1005
January 21, 2013, 12:52:41 PM
#4
The receive payments API has been updated to include some extra callback parameters:

input_transaction_hash = the original transaction hash
input_address = the original input address
destination_address = the final destination address

The confirmations parameter will now be the number of confirmations of the original transaction, not the forwarding transaction. hope that helps.
member
Activity: 67
Merit: 42
January 12, 2013, 05:13:35 PM
#3
Ok thanks, I will do something along those lines as well. Haven't had time to test it yet though...

Obyee.com looks like a good idea and nicely executed as well! Good work! Smiley

I too ran across this when developing Oybee.com. I wouldn't mind if they changed it. In order to get around it I did what you explained and followed the transaction back one step. I then stored the address from the first transaction and manually check the amount of BTC in that address with the number of confirms I'm looking for. In PHP the code is as follows. I hope it helps.

Quote
//Get address user sent to
$string = file_get_contents("https://blockchain.info/rawtx/$transactionhashfromcallback");
$array = json_decode($string, TRUE);
$address = $array['inputs'][0]['prev_out']['addr'];

//Check the amount of Satoshi in the address with the specified confirms
$received = $file_get_contents("https://blockchain.info/q/getreceivedbyaddress/$address?confirmations=$neededconfirms");

full member
Activity: 214
Merit: 100
January 10, 2013, 11:13:19 PM
#2
I too ran across this when developing Oybee.com. I wouldn't mind if they changed it. In order to get around it I did what you explained and followed the transaction back one step. I then stored the address from the first transaction and manually check the amount of BTC in that address with the number of confirms I'm looking for. In PHP the code is as follows. I hope it helps.

Quote
//Get address user sent to
$string = file_get_contents("https://blockchain.info/rawtx/$transactionhashfromcallback");
$array = json_decode($string, TRUE);
$address = $array['inputs'][0]['prev_out']['addr'];

//Check the amount of Satoshi in the address with the specified confirms
$received = $file_get_contents("https://blockchain.info/q/getreceivedbyaddress/$address?confirmations=$neededconfirms");

member
Activity: 67
Merit: 42
January 10, 2013, 07:15:30 PM
#1
Hello,

I'm implementing the blockchain.info payment API, as documented at http://blockchain.info/api/api_receive

It works great but there is something I wonder about. To test it I made a payment using my mobile phone and the Androind Bitcoin Wallet app. Well the actual app shouldn't make a difference, just to provide you with context... Ok, so I mad the payment, and on the receiving side I would like to confirm the payment. I got the calls to my URL from blockchain.info, so that part was working great. However, when I sent some bitcoins from my phone to my site, that is one transaction, and the transaction from blockchain.info is another. And I want to be able to say with some reliability when the transaction from the user can be considered "confirmed". Say 1 confirmation, or 2 or whatever. The problem however is that this is 2 different transactions. In my case, the transaction from my phone to blockchain.info is this one:

http://blockchain.info/tx/73c7fec96e1f8f980280c7783fc45a29e34ff2eb4926504c49ac1ca81c364186

And then the transaction from blockchain.info to my destination address is this one:

http://blockchain.info/tx/9a9cece502e4a9b8aae0410b025fcdf63ecaf5a3ff6eb21b144a1f4b9a1d2939

Now, the problem is that when I sent the money from my phone, I used the "standard recommended" transaction fee that Bitcoin Wallet suggested, which I immagine most end users would do. This made that transaction confirm much faster than the one where blockchain.info sent the money to me. At the time of writing, the first transaction has 16 confirmations, whereas the other one has 4. There was a time before when I checked and the first one had 7 and the other one 0.

So, for me as a merchant, I get information from blockchain.info about the second transaction, but the one I'm really interested in is the first one. It doesn't matter if the second one takes time, as long as I know that the first one is confirmed, provided that I trust blockchain.info. Which I am ready to do. So, I'm just asking has someone come across this problem? How did you solve it? I'm thinking that it would be possible somehow to follow the second transaction and find the first one, and check how many confirmations that one has, but it feels a bit hackish. Opinions?
Jump to: