1

I just started using the Blockchain.info API, I've set it up to notify me when a payment is made, however all addresses in the callback are the destination address. Shouldn't I have the senders address as well?

Is there any way of getting the senders address, otherwise how am I supposed to reply?

I know transaction has the address, do I just pull the first address from inputs of the transaction?

1

You would need to fetch the transaction using the /rawtx call and use one of those inputs.

However you should not send a refund back to the the sending address unless the user has specifically told this is what will happen as shared wallets cannot receive coins back to the sending address.

  • Thanks Ben, you can close the related ZenDesk ticket. I'm aware of the latter issue and that's fair enough. Do I pull the first or would any do? In everything I've seen so far the first seems to be the sender. Also, if I change my callback url existing callbacks get called with the old url, shouldn't it use whatever the current one is set to? – Lloyd Feb 9 '13 at 19:28
0

I have not tried anything with the blockchain API, but you are trying to reply to a POST they sent you, then just echo or print whatever you are sending back to blockchain.

If you are trying to retrieve data (provided it is POSTed) you can use this to figure out what all is being sent to you.

foreach($_POST as $key => $value){
    $data = $key.' => '.$value.' : '.$data;
}

file_put_contents('FILENAME.txt', $data);
  • Sorry you must misunderstand, I'm talking about Bitcoin addresses, nothing to do with GET/POST. If they send me some BTC and for example, I want to do a refund (in code naturally). – Lloyd Feb 9 '13 at 0:11
  • If you print all the key value pairs and the address is not there, then they are not sending it. – fwho Feb 9 '13 at 0:20
  • And that's my point. Where is it? In everything I've seen it doesn't send it as part of the callback. So how do I find it is what I want to know. At present the only place I can see it is in the TX but I don't know how prudent it is to pull it from that as some TX have multiple inputs :/ – Lloyd Feb 9 '13 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.