Bitcoin Forum
November 22, 2017, 04:01:57 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: send payment via php?  (Read 599 times)
velacreations
Sr. Member
****
Offline Offline

Activity: 476


View Profile
January 31, 2013, 06:50:57 PM
 #1

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?

Join ICO Now Coinlancer is Disrupting the Freelance marketplace!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511323317
Hero Member
*
Offline Offline

Posts: 1511323317

View Profile Personal Message (Offline)

Ignore
1511323317
Reply with quote  #2

1511323317
Report to moderator
1511323317
Hero Member
*
Offline Offline

Posts: 1511323317

View Profile Personal Message (Offline)

Ignore
1511323317
Reply with quote  #2

1511323317
Report to moderator
1511323317
Hero Member
*
Offline Offline

Posts: 1511323317

View Profile Personal Message (Offline)

Ignore
1511323317
Reply with quote  #2

1511323317
Report to moderator
piuk
Hero Member
*****
expert
Offline Offline

Activity: 910



View Profile WWW
January 31, 2013, 07:18:57 PM
 #2

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?>

velacreations
Sr. Member
****
Offline Offline

Activity: 476


View Profile
January 31, 2013, 07:41:35 PM
 #3

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.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!