Handler Function Checkout Code


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server">
     <title>BOS Center Sample App</title>
     <form action="ChargePage.aspx" method="post" name="BospayForm">
          <input id="Bospay_payment_id" type="hidden" name="Bospay_payment_id" />
          <input id="Bospay_order_id" type="hidden" name="Bospay_order_id" />
          <input id="Bospay_signature" type="hidden" name="Bospay_signature" />
     </form>
</head>
    <body>
        <button id="rzp-button1">Pay with Bospay</button>
        <script src="https://checkout.razorpay.com/v1/checkout.js"></script>
        <script>
               var orderId = "<%=orderId%>"
                var options = {
                "name": "Acme Corp",
                "description": "Buy Green Tea",
                "order_id": orderId,
                "image": "https://example.com/your_logo",
                "prefill": {
                    "name": "Gaurav Kumar",
                    "email": "gaurav.kumar@example.com",
                    "contact": "+919000090000",
                },
                "notes": {
                    "address": "Hello World"
                },
                "theme": {
                    "color": "#3399cc"
                }
            }
            // Boolean whether to show image inside a white frame. (default: true)
            options.theme.image_padding = false;
            options.handler = function (response) {
                document.getElementById('Bospay_payment_id').value = response.Bospay_payment_id;
                document.getElementById('Bospay_order_id').value = orderId;
                document.getElementById('Bospay_signature').value = response.Bospay_signature;
                document.BospayForm.submit();
            };
                options.modal = {
                ondismiss: function () {
                    console.log("This code runs when the popup is closed");
                },
                // Boolean indicating whether pressing escape key
                // should close the checkout form. (default: true)
                escape: true,
                // Boolean indicating whether clicking translucent blank
                // space outside checkout form should close the form. (default: false)
                backdropclose: false
            };
            var rzp = new Bospay(options);
            document.getElementById('rzp-button1').onclick = function (e) {
                rzp.open();
                e.preventDefault();
            }
        </script>
    </body>
    </html>
                        

Did this page help you?     Yes    No