결제 취소 존재하지 않는 결제 정보 입니다.
상점아이디 : 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 요청 보내는데 계속 존재하지 않는 결제 정보 입니다라고 날라오는데 확인 가능할까요?
주문번호 : 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 요청 보내는데 계속 존재하지 않는 결제 정보 입니다라고 날라오는데 확인 가능할까요?
