결제위젯 결제승인 API 호출후

github 는 payment-samples 의 success.php ,
isSuccess 가 not true ...
secretKey .
.
----------------------------------------------------------------------------
$url = 'https://api.tosspayments.com/v1/payments/confirm';
$data = ['paymentKey' => $paymentKey, 'orderId' => $orderId, 'amount' => $amount];

//$secretKey = 'test_ak_ZORzdMaqN3wQd5k6ygr5AkYXQGwy';
$secretKey = 'test_sk_zXLkKEypNArWmo50nX3lmeaxYG5R';
$credential = base64_encode($secretKey . ':');

$curlHandle = curl_init($url);
curl_setopt_array($curlHandle, [
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => [
'Authorization: Basic ' . $credential,
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($data)
]);

$response = curl_exec($curlHandle);
$httpCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
$isSuccess = $httpCode == 200;
Was this page helpful?