Send Payment error in Blockchain API

0 votes

Im trying to send a payment via the blockchain API v2 using PHP & Curl. Ths blockchain-wallet-service I am using is : 0.26.0 v node.js : 8.9.0 v

I am unable to send payments via the API, please help I have looked up many websites for answers.

Following is my PHP code:

$my_api_key = 'xxxxx';
$guid='xxxxx';
$firstpassword='xxxx';
$second_password = "xxxx";
$amount = '30000';
$to = '1AQDhKrjvAonjLAUv4PzM9NjGzZZ4HEpU1';
$fee = '2000';

$root_url = 'http://localhost:3000/merchant/'.$guid.'/payment';
$parameters = 'to='.$to.'&amount='.$amount.'&password='.$firstpassword.'&fee='.$fee.'&second_password='.$second_password;

$response = Curl::to($root_url . '?' . $parameters)->get();


return $response;

I am getting the following error: [object object] the response gives me : {"error":"Unexpected error, please try again"}

Please help.

Jul 6, 2018 in Blockchain by sabby
• 4,390 points
1,717 views

1 answer to this question.

0 votes

The following code should help:

$address = null;

try {
    // Uncomment to send
    // var_dump($Blockchain->Wallet->send($address, "0.001"));
} catch (\Blockchain\Exception\ApiError $e) {
    echo $e->getMessage() . '<br />';
}

// Multi-recipient format
$recipients = array();
$recipients[$address] = "0.001";

try {
    // Uncomment to send
// var_dump($Blockchain->Wallet->sendMany($recipients));
} catch (Blockchain_ApiError $e) {
echo $e->getMessage() . '<br />';
}
answered Jul 6, 2018 by Perry
• 17,100 points

Related Questions In Blockchain

+1 vote
1 answer

Unable to send payment using API. Please help.

Firstly, check your passwords, your API code and your wallet ...READ MORE

answered Apr 3, 2018 in Blockchain by Christine
• 15,790 points
1,085 views
+1 vote
1 answer

Error while deploying chaincode in IBM Blockchain. Please help.

Try stripping out the 'tree/master' portion of ...READ MORE

answered Apr 26, 2018 in Blockchain by Christine
• 15,790 points
838 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,370 points
11,838 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,043 views
0 votes
0 answers

Blockchain.info wallet API callback

I am implementing blockchain.info wallet api to ...READ MORE

Jul 4, 2018 in Blockchain by sabby
• 4,390 points
832 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
808 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,882 views
0 votes
1 answer

How to check payment in Blockchain.info wallet?

The above error is probably occurring due ...READ MORE

answered Aug 21, 2018 in Blockchain by Perry
• 17,100 points
1,135 views
0 votes
1 answer

How can i read headers of blockchain in multichain?

You could use a recent feature known ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,100 points
697 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP