I am trying to let people pay on my site with a simple API of Coinpayments (I tought it was simple). So, I found this page of the official Coinpayments website on how to create a transaction and receive money.
So, I am trying to receive the response as JSON en just echo it for now, so I can see what further steps I will take. Now, this is my code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.coinpayments.net/index.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"cmd=create_transaction&amount=".$amount."¤cy1=USD¤cy2=BTC&buyer_email=".$email."&version=1&key=b07f0fee01909b919235d58a950378b8c0e5266fa2174e007b24220a592aa92e&format=json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch);
When I try to echo
the $server_output
, it gives this: ERROR: Invalid command!
. I have searched around, and I couldn't find anybody having the same issue as I do.
Thanks for the help! <3