Bitcoin Forum

Economy => Service Discussion => Topic started by: jayc89 on February 12, 2014, 09:00:40 PM



Title: BlockChain Receive Payments API Question?
Post by: jayc89 on February 12, 2014, 09:00:40 PM
I'm looking for a way to include the source\sending address within the callback string when using BlockChain's Receive Payments API. Does anyone know if this is possible?

I would have thought it would be a fair straight forward requirement, but I cant see any reference to the source address in their limited documentation.


Title: Re: BlockChain Receive Payments API Question?
Post by: BawsyBoss on February 12, 2014, 11:08:41 PM
I'm looking for a way to include the source\sending address within the callback string when using BlockChain's Receive Payments API. Does anyone know if this is possible?

I would have thought it would be a fair straight forward requirement, but I cant see any reference to the source address in their limited documentation.
They don't have a function for that. Instead, get its transaction ID and then use the transaction API to do it. This is probably done this way because there can be mote than one input address for transactions. You could also just use a different address per transaction.


Title: Re: BlockChain Receive Payments API Question?
Post by: jayc89 on February 12, 2014, 11:17:34 PM
I'm looking for a way to include the source\sending address within the callback string when using BlockChain's Receive Payments API. Does anyone know if this is possible?

I would have thought it would be a fair straight forward requirement, but I cant see any reference to the source address in their limited documentation.
They don't have a function for that. Instead, get its transaction ID and then use the transaction API to do it. This is probably done this way because there can be mote than one input address for transactions. You could also just use a different address per transaction.

Thanks for that, if you're referring to something like "http://blockchain.info/rawtx/$tx_hash", $tx_hash being the ID sent to the callback page, unfortunately that shows me the transaction for newly generated address -> destination address

I need a way of reversing that a step further and logically identifying the ID for the source address -> newly generated address transaction.


Title: Re: BlockChain Receive Payments API Question?
Post by: taranakiblaze on February 18, 2014, 06:25:29 AM
1. Every time you generate the address you'll have to also generate a unique code (Incrementing index is easiest).  Include the unique code as a refer in your callback address (eg www.yoursite.com/callback.php?refer=$unique_code)  Save the address you generated along with the unique code and any other data you may need.
2. When blockchain fires a callback, they will send you the same unique code.  Your callback will have to search your database for the code and the address the relates to it.  Use the http://blockchain.info/address/$bitcoin_address?format=json API to get an array of the transactions, get the lastest deposit and get the sending address from there :).