Bitcoin Forum

Economy => Service Discussion => Topic started by: icanscript on March 15, 2015, 08:05:45 PM



Title: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: icanscript on March 15, 2015, 08:05:45 PM
Hi, (Not sure if this is correct section)

I have been working for someone to create a payment gateway using BlockCypher. Everything seems to work well.... apart from receiving anything on the callback.

I can see the callback happening, But I have not received any GET or POST variables from the callback. Such as TXid, Input Address, Value.

Has anyone experienced a similar issue before? or even used this provider?

Thanks in advance

icanscript


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: mriou on March 16, 2015, 12:12:21 AM
Hey there, co-founder and CTO of BlockCypher here.

Can you clarify what you mean by GET or POST variables? Callbacks are done using POST requests and the details of the payments are in the body of the POST as a JSON document, not as URL parameters if that's what you were expecting.


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: icanscript on March 16, 2015, 08:08:37 AM
Hey there, co-founder and CTO of BlockCypher here.

Can you clarify what you mean by GET or POST variables? Callbacks are done using POST requests and the details of the payments are in the body of the POST as a JSON document, not as URL parameters if that's what you were expecting.

Fixed :) Thanks for this information :)


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: RussianRaibow on October 31, 2015, 06:17:12 PM
Hey there, co-founder and CTO of BlockCypher here.

Can you clarify what you mean by GET or POST variables? Callbacks are done using POST requests and the details of the payments are in the body of the POST as a JSON document, not as URL parameters if that's what you were expecting.

Fixed :) Thanks for this information :)

Could you or anyone can post here how the problem was solved. The callback response is only providing me some garbage value. Moreover, is it possible to have success response only after a certain number of confirmation?


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: mriou on October 31, 2015, 06:51:34 PM
Not sure what exactly was the issue described above but I'm guessing it was related to decoding the JSON body. The full transaction is sent in the POST body as JSON, make sure you decode that properly with the programming language you're using (for ex in PHP check http://stackoverflow.com/questions/8945879/how-to-get-body-of-a-post-in-php).

Once you can decode the full transaction, the number of confirmations is a property there.


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: RussianRaibow on October 31, 2015, 07:25:57 PM
Not sure what exactly was the issue described above but I'm guessing it was related to decoding the JSON body. The full transaction is sent in the POST body as JSON, make sure you decode that properly with the programming language you're using (for ex in PHP check http://stackoverflow.com/questions/8945879/how-to-get-body-of-a-post-in-php).

Once you can decode the full transaction, the number of confirmations is a property there.

I tested with this...

http://blockcypher.github.io/php-client/sample/doc/payment-api/CreateForwardingAddress.html

When payment is made to the created address, it is getting forwarded with a success callback like...

Code:
Results: Array
(
)


Results: Array
(
    [uniqid] => 54321abcde
)
sample data used

Once callback URL, which contains the following code, is called with this Unique ID...

http://blockcypher.github.io/php-client/sample/doc/payment-api/GetForwardingAddress.html

I am getting the following result...

Code:
Results: Array
(
)


Results: Array
(
    [uniqid] => 54321abcde
    [__utma] => 12.34.56.78.90.12
    [fc] => {"abcd":"1:1234"}
    [pv] => {"d":"1:5432"}
    [__cfduid] => abcde54321
    [_ga] => GA1.2.34.56
    [__utmz] => 98.76.54.32.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/example/
)
sample data used

Now, how do I decipher the above data?


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: RussianRaibow on November 23, 2015, 08:47:00 PM
Does anyone know how to stop blockcypher callback for every single confirmation after a payment is made through the payment forwarding API with enable_confirmations = true ?


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: mriou on November 23, 2015, 09:12:42 PM
Do you want the callbacks to stop at some point or just have a lower number of confirmations than 6? For the latter you can just set enable_confirmations=false and create a webhook yourself with the desired confirmation count.


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: bjalkidottir on November 23, 2015, 10:28:35 PM
Does anyone know how to stop blockcypher callback for every single confirmation after a payment is made through the payment forwarding API with enable_confirmations = true ?

code an if statement to only complete whatever action after x amount of confirmations.


Title: Re: blockcypher.com API PHP - Not receiving any POST variables on callback
Post by: RussianRaibow on December 09, 2015, 11:45:57 PM
Do you want the callbacks to stop at some point or just have a lower number of confirmations than 6? For the latter you can just set enable_confirmations=false and create a webhook yourself with the desired confirmation count.
I want the callbacks to stop at some point. Will it stop at 6 automatically ?

I'd also like to know the difference between [n_tx] & [final_n_tx] ?