현금영수증 INVALID_REQUIRED_PARAM 에러

php , 릿, .

{"code":"INVALID_REQUIRED_PARAM","message":"."}

.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tosspayments.com/v1/cash-receipts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 15000,
'orderId' => 'a4CWyWY5m89PNh7xJwhk1',
'orderName' => '외 2',
'customerIdentityNumber' => '01012341234',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic 릿()",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Was this page helpful?