ok
Direktori : /home2/selectio/public_html/y1jobportal.in/ |
Current File : /home2/selectio/public_html/y1jobportal.in/drawings.php |
<?php ob_start(); $amount = 100; $order_id = 100; $user_id = 1; /*$amount = 1;*/ // $merchantKey = '14fa5465-f8a7-443f-8477-f986b8fcfde9'; // Live - TNPSC $merchantKey = '4c6ab592-0990-4292-8b4a-f9537fa6d02f'; /*$merchantKey ='14fa5465-f8a7-443f-8477-f986b8fcfde9'; */ // Testing : 14fa5465-f8a7-443f-8477-f986b8fcfde9 /*$url = $booking_id; $encryptionKey = 'TTC'; $encryptedUrl = openssl_encrypt($url, 'aes-256-cbc', $encryptionKey, 0, $encryptionKey); $code = urlencode($encryptedUrl);*/ $encryptionKey = 'YI'; // Generate a random IV (Initialization Vector) of 16 bytes $iv = openssl_random_pseudo_bytes(16); // URL to encrypt $url = $order_id; // Encrypt the URL $encryptedUrl = openssl_encrypt($url, 'aes-256-cbc', $encryptionKey, 0, $iv); // To pass both the IV and the encrypted URL, you can concatenate them $ivAndEncryptedUrl = $iv . $encryptedUrl; // Encode the combined string for safe URL use $code = urlencode(base64_encode($ivAndEncryptedUrl)); $ids = $_GET['id']; error_log('stepen'.$ids); $data = array( // "merchantId" => "M22Q7LA2RCPU4", // Live - TNPSC M22CJUUBLAV8P dcart "merchantId" => "M1WU3XVU5GAA", // Testing - TNPSC : PGTESTPAYUAT77 "merchantTransactionId" => bin2hex(random_bytes(6)).'_'.$ids, "merchantUserId" => $ids, "amount" => $amount*1, "redirectUrl" => "https://y1jobportal.in/success.php", "redirectMode" => "POST", "callbackUrl" => "https://y1jobportal.in/success.php", "mobileNumber" => "9345854079", "paymentInstrument" => array( "type" => "PAY_PAGE" ) ); $payloadMain = base64_encode(json_encode($data)); $payload = $payloadMain."/pg/v1/pay".$merchantKey; $Checksum = hash('sha256', $payload); $Checksum = $Checksum.'###1'; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.phonepe.com/apis/hermes/pg/v1/pay", // Live - Tnpsc // CURLOPT_URL => "https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay", // Testing - TNPSC 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([ 'request' => $payloadMain ]), CURLOPT_HTTPHEADER => [ "Content-Type: application/json", "X-VERIFY: ".$Checksum, "accept: application/json" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { header('Location: paymentfailed.php?cURLError='.$err); } else { $responseData = json_decode($response, true); $url = $responseData['data']['instrumentResponse']['redirectInfo']['url']; header('Location: '.$url); } ?>