index - PHP 2.68 KB
                    
             <?php
/*
 * @author ohari5336(Hari Om Batra<#@R! ()M>)
 * @website https://ohari5336.in/
 * @facebbok https://www.facebook.com/ohari5333
 * @twitter https://twitter.com/ohari5333
 * @linkedin https://www.linkedin.com/in/ohari5336/
 */


function httpPost($url,$params) {
    $postData = '';
    //create name value pairs seperated by &
    foreach($params as $k => $v) {
        $postData .= $k . '='.$v.'&';
    }
    $postData = rtrim($postData, '&');
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_USERPWD,  'your key');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $output=curl_exec($ch);
    curl_close($ch);
    return $output;

}

if (isset($_POST,$_POST['amt'],$_POST['email'],$_POST['phone'],$_POST['des'])) {

    $params = array(
        "amount" => $_POST['amt'],
        "order_id" => "ohari_ord_".rand(),
        "customer_id" => "ohari_user_".rand(),
        "customer_email" => $_POST['email'],
        "customer_phone" => $_POST["phone"],
        "product_id" => "ohari_demo",
        "description" => $_POST['des']
    );

    $data = json_encode($params);

    file_put_contents('./payment_submits.log', "Status Update:\n{$data}\n\n", FILE_APPEND);

    $json_res = httpPost("https://axisbank.juspay.in/orders",$params);

    $json_res_decode = json_decode($json_res, true);

    $iframe_link = $json_res_decode['payment_links']["iframe"];
}

?>

<?php if(isset($_POST,$_POST['amt'])){ ?>
<iframe style="width: 800px; height: 500px;" src="<?php echo $iframe_link ?>"></iframe>
<?php } else { ?>

<form method="post" target="_self">
    <label>amount: </label><input type="text" name="amt" value="10.00"><br>
    <label>Email: </label><input type="email" name="email" value="customer@gmail.com"><br>
    <label>phone: </label><input type="tel" name="phone" value="919988665522"><br>
    <label>description: </label><input type="text" name="des" value="Order Info"><br>
    <input type="submit" value="Submit">
</form>

<?php } ?>
            
            

Paste Hosted With By Codes Ohari5336