<!-- start page content -->
            <div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title">Payment Option</div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.html">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="">Centers</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li class="active">Payment Option</li>
                            </ol>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header>Payment Option</header>                                   
                                </div>                              
                                <div class="card-body" id="bar-parent">
                                    <form id="form_sample_1" class="form-horizontal" action="#" method="post">
                                        <div class="form-body">
                                        <div class="form-group row <?php if(form_error('amount_paid')){ ?>has-error<?php } ?>">
                                                <label class="control-label col-md-3">Add Amount 
                                                    <span class="required"> * </span>
                                                </label>
                                                <div class="col-md-5">
                                                    <input type="text" name="amount_paid"  id="amount_paid" placeholder="Enter Amount" class="form-control input-height" value="<?=set_value('amount_paid');?>"  /> 
                                                    <span class="help-block"> <?=form_error('amount_paid'); ?> </span>
                                                    </div>
                                            </div>                                                                                     
                                            <div class="form-actions">
                                            <div class="row">
                                                <div class="offset-md-3 col-md-9">
                                                    <button type="button" class="btn btn-info" id ="buy_now">Submit</button>                                                    
                                                </div>
                                                </div>
                                             </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end page content -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> 
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
  var SITEURL = "<?php echo base_url() ?>";
   $('#buy_now').on('click', function(e){
    var totalAmount = $("#amount_paid").val();
    var product_id =  "<?=rand(1,100000000);?>";
    $("#buy_now").text("");  
    $("#buy_now").append("<img src='/jnu/images/btn-loader.gif'/>");
    $.ajax({
            url: SITEURL + 'payment/razorPayOrder',
            type: 'post',
            dataType: 'json',
            data: {
                 totalAmount : totalAmount ,product_id : product_id,
            }, 
            success: function (data) { 
                $("#buy_now").text("");
                $("#buy_now").text("Submit");
               if(data.id !=''){
                 var options = {
                    "key": "rzp_live_iWrDGArHDuXH35",
                    "amount": totalAmount*(1*100), // 2000 paise = INR 20
                    "name": "Blackboard India",
                    "description": "Payment",
                    "order_id":data.id,
                    "image": "http://blackboardindia.com/assets/front/images/logo.jpg",
                    "handler": function (response){
                        console.log(response);
                          $.ajax({
                            url: SITEURL + 'payment/razorPaySuccess',
                            type: 'post',
                            dataType: 'json',
                            data: {
                                razorpay_payment_id: response.razorpay_payment_id , totalAmount : totalAmount ,product_id : product_id,
                            }, 
                            success: function (msg) { 
                               window.location.href = '/jnu/payment/payment_status/1';
                            }
                        });
                      
                    },                 
                    "theme": {
                        "color": "#528FF0"
                    }
                  };
                  var rzp1 = new Razorpay(options);
                  rzp1.open();
                  e.preventDefault();
               }            
           }
        }); 
 });
  $('#buy_now11').on('click', function(e){
    var totalAmount = $("#amount_paid").val();
    var product_id =  "<?=rand(1,100000000);?>";
    var order_id ='order_CmTwNJ1r8B41Z1';
    var options = {
    "key": "rzp_live_iWrDGArHDuXH35",
    "amount": totalAmount*(1*100), // 2000 paise = INR 20
    "name": "Blackboard India",
    "description": "Payment",
    "order_id":order_id,
    "image": "http://blackboardindia.com/assets/front/images/logo.jpg",
    "handler": function (response){
        console.log(response);
          $.ajax({
            url: SITEURL + 'payment/razorPaySuccess',
            type: 'post',
            dataType: 'json',
            data: {
                razorpay_payment_id: response.razorpay_payment_id , totalAmount : totalAmount ,product_id : product_id,order_id:order_id,
            }, 
            success: function (msg) { 
               window.location.href = '/jnu/payment/payment_status/1';
            }
        });
      
    },
 
    "theme": {
        "color": "#528FF0"
    }
  };
  var rzp1 = new Razorpay(options);
  rzp1.open();
  e.preventDefault();
  });
 
</script>