Title: send payment via php? Post by: velacreations on January 31, 2013, 06:50:57 PM Does anyone know how to send a payment using php and the Blockchain.info api?
Here's the api link: http://blockchain.info/api/json_rpc_api In there it gives a method for doing so: Quote Method: sendtoaddress Parameters: (String bitcoinAddress, long amount) Description: amount is a real and is rounded to 8 decimal places. Returns the transaction hash if successful. . Returns: String Second Password Required But it says Second Password Required. So how do I pass my second password? Higher on the page, it says this: Quote Security This api is currently incompatible with two factor authentication and it must therefore be disabled. So, how do I send a payment? Title: Re: send payment via php? Post by: piuk on January 31, 2013, 07:18:57 PM Does anyone know how to send a payment using php and the Blockchain.info api? Here's the api link: http://blockchain.info/api/json_rpc_api In there it gives a method for doing so: Quote Method: sendtoaddress Parameters: (String bitcoinAddress, long amount) Description: amount is a real and is rounded to 8 decimal places. Returns the transaction hash if successful. . Returns: String Second Password Required But it says Second Password Required. So how do I pass my second password? The second password is provided by first calling the walletpassphrase method. This api is currently incompatible with two factor authentication and it must therefore be disabled. So, how do I send a payment? Two factor authentication must be disabled in Account Settings. ------ Assuming you only want to send you would be better off using http://blockchain.info/api/blockchain_wallet_api. Very rough example <?php $wallet_identifier = 'abf66471-fe0a-6820-8977-55d7e8c1f6b2'; $address = 'Your Bitcoin address'; $password = 'Your Password'; $second_password = 'Your Second password'; //Only if double encryption is enabled in account settings $amount = 100000000; //1 BTC in Satoshi $response = file_get_contents("https://blockchain.info/merchant/$wallet_identifier/payment?password=$password!&second_password=$second_password&to=$address&amount=$amount"); //Check response for errors php?> Title: Re: send payment via php? Post by: velacreations on January 31, 2013, 07:41:35 PM yeah, I was just reading about that method on the Wallet API. Thanks for that.
Is there any good code snippets around for handling errors? I'm basically seeing if response is empty or not an array, but I imagine there is a better method. |