How do I get the originating address using Blockchain.info's recieving API?

0

I'm using the blockchain.info/api/api_receive

I have everything working fine but when I made a payment I can't find (in the callback) the bitcoin address of the payer, only the address of the payee...

callback example:

{  
   "input_transaction_hash":"0a11043d6e067bad827d4c82da2c45e99323f3a0b28f843fae156bcbd7e8a1d2",
   "shared":"false",
   "address":"1MVSoHC5M875Pbz5FfzckA35A6LpbmNcpo",
   "destination_address":"1MVSoHC5M875Pbz5FfzckA35A6LpbmNcpo",
   "input_address":"1NjbP7RFN6sQbEp6wVc21ZpKRhoR4PaLbR",
   "invoice_id":"40",
   "anonymous":"false",
   "secret":"eijfei4333",
   "confirmations":"4",
   "value":"1407217",
   "transaction_hash":"0d28f482f56c784c3f09be9e49ea45de76a49ae91efbeab43a7bfec417c37005"
}

How can I find out the payers address? Thanks

Pedro

Posted 2015-05-11T05:41:45.377

Reputation: 1

You can't, unfortunately. You have to ask them to give you a separate refund-address. – morsecoder – 2015-05-11T14:32:47.720

Answers

2

You can use blockchain.info's API to look this up, specifically you're looking for the inputs of the "input_transaction_hash" tx:

https://blockchain.info/rawtx/0a11043d6e067bad827d4c82da2c45e99323f3a0b28f843fae156bcbd7e8a1d2

Result:

{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":86277579,
            "type":0,
            "addr":"1JfkMijQTFsRbfDhqTU8Sacx2JVGiSs8af",
            "value":20470771,
            "n":1,
            "script":"76a914c1ce233e2d34facb69aa2b1233db07929586691388ac"
         },
         "script":"49304602210091a3b8759a99abcf4eaa1d3205f5d89e5243faa9ea166c3a9d2f34889dd5f86c02210080738b0beb1cbede15061d2ba5e37033bcc16848b06807e6c3ab2837ef281a99012102665ea1fd74fdb940be0245633ee276bb2abc4a650a16eb77601ed0c3ffd37293"
      }
   ],
   ...

Please be aware that actually using the "from" addresses (there are often multiple) for any purpose is dangerous and strongly discouraged, please see Can a bitcoin transaction be reversed from the receiving end? for more details.

If you have a need to collect a return address for some purpose, you should consider using BIPs-70/71/72 instead.

Christopher Gurnee

Posted 2015-05-11T05:41:45.377

Reputation: 2 333