Sindbad~EG File Manager

Current Path : /home/numerotech/paymentapi.numerotech.com/paymentapi/core/templates/paypal/
Upload File :
Current File : //home/numerotech/paymentapi.numerotech.com/paymentapi/core/templates/paypal/paypal_screen.html

<!DOCTYPE html>
<!-- example from https://developer.paypal.com/demo/checkout/#/pattern/client -->
<html>
<head>
    <!-- Add meta tags for mobile and IE -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />


     <link rel="stylesheet" type="text/css" href="{{ ('/static/css/bootstrap.min.css') }}">
     <link rel="stylesheet" type="text/css" href="{{ ('/static/css/style.css') }}">


    <script type= "text/javascript"  src="/static/js/jquery.min.js"></script>
       <script  type= "text/javascript" src="/static/js/popper.min.js"></script>
       <script type= "text/javascript" src="/static/js/bootstrap.min.js"></script>
</head>

<body>
    <input type="hidden" name="currency_code" id="currency_code" value="{{currency_code}}">
    <input type="hidden" name="amount" id="amount" value="{{amount}}">
    <input type="hidden" name="app_key" id="app_key" value="{{app_key}}">
    <input type="hidden" name="remarks" id="remarks" value="{{remarks}}">
    <input type="hidden" name="unique_id" id="unique_id" value="{{unique_id}}">
    <input type="hidden" name="res_url" id="res_url" value="{{res_url}}">

    
    <!-- <div id="paypal-button-container"></div> -->

    <div class="row mt-5">
        <div class="col-md-4"></div>

        <div class="col-md-4">
            <div class="row">
                <div class="col">
                    
                    <label>Amount :</label> <h4>{{currency_code}}  {{amount}} </h4>
                </div>
                
            </div>    
            
             <!-- Set up a container element for the button -->
             <div id="paypal-button-container"></div>

             <br/> <br/>
              <!-- <button class="btn btn-danger btn-block text-center">Cancel</button> -->
              <a href="{{res_url}}" class="btn btn-danger btn-block text-center" >Cancel</a>
        </div>

        <div class="col-md-4"></div>
    </div>

    <!-- Include the PayPal JavaScript SDK -->
    <script src="https://www.paypal.com/sdk/js?client-id={{client_id}}&currency={{currency_code}}"></script>

    <script type="text/javascript">

    $(document).ready(function ()
    {

    var currency_code_1 = $("#currency_code").val();
    var amount          = $("#amount").val();
    var remarks         = $("#remarks").val();
    var unique_id       = $("#unique_id").val();
    var app_key         = $("#app_key").val();


    

        // Render the PayPal button into #paypal-button-container
        paypal.Buttons({

            // Set up the transaction
            createOrder: function(data, actions) {
                return actions.order.create({


// You can find a working example purchase_units at https://developer.paypal.com/docs/checkout/reference/server-integration/set-up-transaction/
  purchase_units: [ {
                reference_id: "REFID-000-1001",
                description: remarks,
                soft_descriptor: remarks,
                
                custom_id :  unique_id,
                amount: {
                    currency_code: currency_code_1,
                    value: amount,
                    breakdown: {
                        item_total: {
                            currency_code: currency_code_1,
                            value: amount
                        }
                    }
                }, items: [{
                        name: "Item 1",
                        description: "Registration",
                        sku: "xyz-2654",
                        unit_amount: {
                            currency_code: currency_code_1,
                            value: amount
                        },
                        quantity: "1"
                    }]
                
            
        }
        ]

  ,
  application_context: {
    brand_name: app_key,
    /*shipping_preference: 'NO_SHIPPING'*/
  }


                }/*end of parameters to actions.order.create*/);
            },

            // Finalize the transaction
            onApprove: function(data, actions) {
                return actions.order.capture().then(function(details) {
                    // Show a success message to the buyer
                    // alert('Transaction completed by ' + details.payer.name.given_name + '!');

                   console.log('Capture result', details, JSON.stringify(details, null, 2));
                    var transaction = details.purchase_units[0].payments.captures[0];
                    // alert('Transaction '+ transaction.status + ': ' + transaction.id + '\n\nSee console for all available details');


                     window.location.replace("https://paymentapi.numerotech.com/payment_api/transaction_details/"+transaction.id+"/"+unique_id+"/"+transaction.status); // working fine
                });
            }


        }).render('#paypal-button-container');


        });
    </script>

   
     

</body>

</html>




Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists