결제 취소 존재하지 않는 결제 정보 입니다.

: hangukoxsv
: 2024061914471712

// 문 ID (의 ID)
$orderId = $od['od_tno'];
// 한 API URL
$apiUrl = 'https://api.tosspayments.com/v1/payments/' . $orderId . '/cancel';

//
$cancelReason = '';

// cURL
$ch = curl_init($apiUrl);

// cURL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'cancelReason' => $cancelReason
]));

// HTTP
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode($secretKey . ':')
]);

// API
$response = curl_exec($ch);

// cURL
curl_close($ch);
로 api ?
Was this page helpful?