ok
Direktori : /proc/self/root/proc/thread-self/root/proc/self/root/home2/selectio/public_html/a-pay/ |
Current File : //proc/self/root/proc/thread-self/root/proc/self/root/home2/selectio/public_html/a-pay/srisalem.php |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Phone Integration</title> </head> <body> <br> <center><h1>Phone Pay Integration </h1> <br> <hr> <form action="#" method="post"> <label for="amountEnterByUsers">Enter Amount</label> <input type="number" name="amountEnterByUsers" id="amountEnterByUsers"> <br><hr> <button type="submit" name="submit_form">Pay Now</button> </form> </center> </body> </html> <?php if (isset($_POST['submit_form'])) { $amount = $_POST['amountEnterByUsers']; // $merchantKey = '0e085b1b-1d98-48c0-a139-e75cb12b2721'; // live : 4c6ab592-0990-4292-8b4a-f9537fa6d02f $merchantKey ='14fa5465-f8a7-443f-8477-f986b8fcfde9'; // testing : 14fa5465-f8a7-443f-8477-f986b8fcfde9 $data = array( "merchantId" => "PGTESTPAYUAT77", //M1WU3XVU5GAA - Drwaingscart Live id //PGTESTPAYUAT77 - Testing //SRISALEMONLINE "merchantTransactionId" => bin2hex(random_bytes(6)), "merchantUserId" => "MU125", "amount" => $amount*100, "redirectUrl" => "https://drawingscart.com/phonepe-payment/paymentsuccess.php", "redirectMode" => "POST", "callbackUrl" => "https://drawingscart.com/phonepe-payment/paymentsuccess.php", "mobileNumber" => "9487202215", "paymentInstrument" => array( "type" => "PAY_PAGE" ) ); // Convert the Payload to JSON and encode as Base64 $payloadMain = base64_encode(json_encode($data)); $payload = $payloadMain."/pg/v1/pay".$merchantKey; $Checksum = hash('sha256', $payload); $Checksum = $Checksum.'###1'; //X-VERIFY - SHA256(base64 encoded payload + "/pg/v1/pay" + salt key) + ### + salt index //https://api.phonepe.com/apis/hermes/pg/v1/pay //https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay", 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); print_r($response); if ($err) { // echo "cURL Error #:" . $err; header('Location: paymentfailed.php?cURLError='.$err); // echo 'failed Page'; // print_r($err); } else { $responseData = json_decode($response, true); $url = $responseData['data']['instrumentResponse']['redirectInfo']['url']; header('Location: '.$url); /*echo 'else Page<br>'; print_r($responseData);*/ } }?>