Author

Topic: Blockchain.info HTTP JSON String for Payement notifications (Read 1150 times)

newbie
Activity: 32
Merit: 0
Quote
BlockExplorer and Blockchain.info are nowhere near ready reliable enough to use as a blockchain database tool for used in ecommerce

Undecided

Okay...

Thank you very much!
legendary
Activity: 2506
Merit: 1010
But if I have to run bitcoin daemon, this would mean that I would be headed to an online wallet?

BlockExplorer and Blockchain.info are nowhere near reliable enough to use as a blockchain database tool for use for ecommerce.

If you don't want to run bitcoind, then perhaps:

 - Bit-Pay
 --  https://bit-pay.com/
 - Mt. Gox Pay Now
 --  https://bitcointalksearch.org/topic/ann-unleash-your-magento-based-e-commerce-website-potential-thanks-to-bitcoin-85520
 - Paysius
 - or the other hosted merchant methods?
newbie
Activity: 32
Merit: 0
But if I have to run bitcoin daemon, this would mean that I would be headed to an online wallet?

Here is what I would like to do:

A user orders smthg on the website, then gets:
'Here is your wallet adress for the payement : 333hghgksuzwzarat678ajhsgjsjs8'

> This adress is recorded in my database in an 'wallet' field, and next to it, a 'verif' field.

Then, a cron job is runned, checking if this adress has been credited, and if yes, the cron job changes the value of the 'verif' field.

Isn't there a way to achieve this without all the bitcoin setup?

Thanks in advance!
legendary
Activity: 2506
Merit: 1010
I am currently building a website with PHP/SQL to sell products in Bitcoins (Nice Swiss stuff...watch out!) and am willing to verify if an amount has been sent to a bitcoin adress I provide when submitting a form.

JSON PHP lib might be what you are looking for. Link to it is in here:
 - http://en.bitcoin.it/wiki/PHP_developer_intro

But to do a shopping cart, you might want to look at using an existing shopping cart tools:
 - http://en.bitcoin.it/wiki/Category:Shopping_Cart_Interfaces



newbie
Activity: 32
Merit: 0
Hi Bitcoin fans Smiley

I am currently building a website with PHP/SQL to sell products in Bitcoins (Nice Swiss stuff...watch out!) and am willing to verify if an amount has been sent to a bitcoin adress I provide when submitting a form.

I have to list the adresses which contains Bitcoins along with their payement status(show amount if verified), so I am looking for the simplest way of doing this.

I found out this piece of code, regarding blockexplorer:

Quote
$Awallets = $row['wallet'];
$Live_Address_Scan = "http://blockexplorer.com/q/getreceivedbyaddress/$Awallets";
$ch = curl_init($Live_Address_Scan);
curl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; GetReceivedBy; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_USERAGENT, "CakeScript/0.1");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$Donated_Bitcoins = curl_exec($ch);
curl_close($ch);

But eventually there are some 'moments' where blockexplorer cannot be sollicited so an error message shows up in the field where the amount should appear  Embarrassed

'Database overload...'

I then came up about blockchain and I have to use this specific code:

Quote
HTTP Post

A HTTP POST request will be made on payment sent or received to URL provided on your My Account page. The POST body will contain one "payload" variable which contains JSON data about the transaction. Any effect on your wallet will need to be calculated by your server.

e.g. Access JSON using php

$_POST['payload']

{
    "hash": "bf8648b06160ded3274d6054cfeadd95f762271170070429ef40d62ac5452c4b",
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 2,
    "lock_time": "Unavailable",
    "size": 258,
    "relayed_by": "71.238.174.98",
    "tx_index": 13903761,
    "time": 1325700693,
    "inputs": [
        {
            "prev_out": {
                "hash": "e417eb0889a1870e6b500ad8769cb7110739749e",
                "addr": "1Mo3ibZuqZpsBGimyfmUnYDiZoU44VbAJV",
                "value": 438000000,
                "tx_index": 13902462,
                "n": 1
            }
        }
    ],
    "out": [
        {
            "value": 215000000,
            "hash": "6c835372a306b2e253f896801cb0b5703d60114c",
            "addr": "1AtmJQYUCVZSwoLkQvEvFhtoRfwn4Eumuu"
        },
        {
            "value": 222000000,
            "hash": "60ce49cd97aa152e1db8a76c1b62c55ae3b059d3",
            "addr": "19przaW7NeE96SEVtKGWdGM3CuKVaSYhrS"
        }
    ]
}
         

As a rudimentary form of verification the HTTP server should respond by printing the user's wallet identifier.

echo '0aef6e46-2422-6d4c-772c-bacccf378b6b';


I managed to have a recognized listener adress along with the echo 'wallet', but then, how do I parse this JSON string? May I ask if someone could point me to the right direction or even show me some code? I do not know how to 'begin', like is it in a
A thousands thanks in advance,

 Smiley
Jump to: