$curl = curl_init();
$url = 'https://test.url/v2/transactions';
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n
\"transaction\": {\n
\"transaction_amount\": \"10\",\n
\"location_id\": \"1111111111\",\n
\"action\": \"sale\"\n
}\n}",
CURLOPT_HTTPHEADER => array(
"content-type: application/json",
"developer-id: dev-1234",
"user-api-key: 2222222222222222",
"user-id: 111111111111111"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}