Im trying to create a button and assign a callback URL with coinbase.
I'm getting some CAPTCHA data returned when trying to post to coinbase API.
I think my webhost is getting blocked by CloudFlare, disabling my code.
Here's what I have:
<a class="coinbase-button" data-code="<?php
$data = array(
"button" => array(
"name" => "Ticket",
"price_string" => "0.01",
"price_currency_iso" => "BTC",
"custom" => $OrderNext . "- " . $ticket,
"callback_url" => "https://x.com/callback.php",
"description" => "Ticket - " . $ticket ,
"type" => "buy_now",
"style" => "buy_now_large"
)
);
$json_data = json_encode($data);
$ch = curl_init("https://coinbase.com/api/v1/buttons?api_key=xxxxxxxxxxxxxxxxxxxxxx");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json_data))
);
if( ! $output = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
$result = json_decode($output);
$output returns a CAPTCHA page.
$result is null.
How do I solve this problem?