alert("성공. 꼭 관리자페이지에서 크로스체크해주세요."); document.location.href = "'.$prevPage.'";'; //ChattingsendTel($GPA." 환불완료"); // 확인 필요 #echo $result; }else{ echo ''; //ChattingsendTel("환불실패"); // 확인 필요 #echo $result; } //function ChattingsendTel($txt){ // $str = sprintf("curl 'https://api.telegram.org/bot5667755292:AAGZnWfVV4BsI5l0EiZb8hvHuNJLD3dzCY4/sendmessage?text=%s&chat_id=-1001828905652' > /dev/null 2>&1 &",urlencode($txt)); // exec($str); //} function Refund_back($package,$client_email,$private_key_id,$private_key,$GPA){ $header = array( "alg" => "RS256", "typ" => "JWT", "kid" => $private_key_id ); $payload = array( "iss" => $client_email, "sub" => $client_email, "scope" => "https://www.googleapis.com/auth/androidpublisher", "aud" => "https://oauth2.googleapis.com/token", "iat" => time(), "exp" => time()+3600 ); $jwt =JWT::encode($payload,$private_key, 'RS256',null,$header); $fields = array( "grant_type" => "urn:ietf:params:oauth:grant-type:jwt-bearer", "assertion" => $jwt ); $post_field_string = http_build_query($fields, '', '&'); $ch = curl_init("https://oauth2.googleapis.com/token"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".$jwt)); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_field_string); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close ($ch); $token=json_decode($result); $token=$token->access_token; $fields = array( "revoke" => "true" ); //&access_token=".$token $ch = curl_init("https://androidpublisher.googleapis.com/androidpublisher/v3/applications/".$package."/orders/".$GPA.":refund"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".$token)); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_field_string); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close ($ch); return $result; } ?>