Bitcoin Forum

Bitcoin => Project Development => Topic started by: Seal on May 31, 2013, 02:19:40 PM



Title: Callback on receive payment
Post by: Seal on May 31, 2013, 02:19:40 PM
I'm in the process of setting up a receive payment server that can make calls when a payment is received.

Essentially I'd like to emulate the behaviour of instant payment notifications as seen on btc-e with live updating confirmations.

Blockchain.info provides something similar (which I'm using at the moment) but their service is unreliable: https://blockchain.info/api/api_receive


Title: Re: Callback on receive payment
Post by: Seal on June 01, 2013, 01:16:42 AM
Anybody?

Coinbase also offers the same functionality: https://coinbase.com/docs/merchant_tools/callbacks


Title: Re: Callback on receive payment
Post by: grue on June 01, 2013, 01:42:31 AM
it's in 0.8.2
Quote
Command-line options
--------------------

* -walletnotify will call a command on receiving transactions that affect the wallet.


Title: Re: Callback on receive payment
Post by: Seal on June 01, 2013, 08:58:50 AM
it's in 0.8.2
Quote
Command-line options
--------------------

* -walletnotify will call a command on receiving transactions that affect the wallet.

Thanks, I did a lot of reading up and it looks like its what I'm after. I'm surprised that there are no pre-written classes to handle this as its something that almost every bitcoin retailer would find useful. The closest I've found is:

https://github.com/hostvpn/whmcs-coinbase-bitcoin/blob/master/modules/gateways/callbacks/coinbase.php

If anyone else out there has written a few functions / classes to handle this then I'd love to see it.


Title: Re: Callback on receive payment
Post by: piuk on June 01, 2013, 10:10:37 AM
In what way are you finding notifications from blockchain unreliable? The speed of forwarding payments or the notifications each new block?


Title: Re: Callback on receive payment
Post by: Seal on June 01, 2013, 12:32:51 PM
In what way are you finding notifications from blockchain unreliable? The speed of forwarding payments or the notifications each new block?

Hey piuk,

Yeah, that was a major issue a few weeks back but even since your fix it still seems to happen sporadically.

Two other issues as well. It appears that the callback url isn't called consistently... Also the logs tell me that my site is returning 'Invalid Server Response'. I'm certain that my response is developed corectly (to not echo anything until 6 confs, then return *ok*)

I will PM you two callback URL's you can check the logs to see what I'm talking about.

Is the server load balanced or traffic throttled in any way? Maybe there are too many outbound/inbound connections? Just thinking out aloud...


Title: Re: Callback on receive payment
Post by: grue on June 01, 2013, 08:50:38 PM
Thanks, I did a lot of reading up and it looks like its what I'm after. I'm surprised that there are no pre-written classes to handle this as its something that almost every bitcoin retailer would find useful. The closest I've found is:

https://github.com/hostvpn/whmcs-coinbase-bitcoin/blob/master/modules/gateways/callbacks/coinbase.php

If anyone else out there has written a few functions / classes to handle this then I'd love to see it.
Considering it's a new feature, there aren't going to be prewriten classes for it.

The description says "Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)". So I would imagine you set the command to a .php/.pl/.py/.sh script that fetches the full transaction info and updates your database.


Title: Re: Callback on receive payment
Post by: ExchangeCurrency on October 24, 2014, 03:25:14 AM
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


Title: Re: Callback on receive payment
Post by: obale on October 24, 2014, 10:02:18 PM
I am working currently on something similar.

My setup consists of one background daemon that monitors the bitcoin network and reacts to incoming transactions. If a transaction matches a given pattern, it is published to a Redis PubSub channel. On the other end a NodeJS application gets the message and forwards it to all connected clients (via socket.io). By using Redis publish/subscribe, it is possible to extend that approach with any notification mechanism, e.g. e-mail, mobile push notifications, SMS, you name it.