Thursday 17 August 2023

how to implement payment gateway




 

<html>

<button id="rzp-button1" class="btn btn-outline-dark btn-lg"><i class="fas fa-money-bill"></i> Own Checkout</button>

<script src="https://checkout.razorpay.com/v1/checkout.js"></script>

<script>

  var options = {

    "key": "Enter Your Key", // Enter the Key ID generated from the Dashboard

    "amount": "1000",

    "currency": "INR",

    "description": "Acme Corp",

    "image": "https://s3.amazonaws.com/rzp-mobile/images/rzp.jpg",

    "prefill":

    {

      "email": "gaurav.kumar@example.com",

      "contact": +919900000000,

    },

    config: {

    display: {

      blocks: {

        banks: {

          name: 'Pay using Axis banks',

          instruments: [

            {

              method: 'netbanking',

              banks: ['UTIB'],

            },

            {

              method: 'card',

              issuers: ['UTIB'],

            },

            {

                method: 'wallet',

                wallets:['payzapp']

            }

          ],

        },

      },

      sequence: ['block.banks'],

      preferences: {

        show_default_blocks: true,

      },

    },

  },

    "handler": function (response) {

      alert(response.razorpay_payment_id);

    },

    "modal": {

      "ondismiss": function () {

        if (confirm("Are you sure, you want to close the form?")) {

          txt = "You pressed OK!";

          console.log("Checkout form closed by the user");

        } else {

          txt = "You pressed Cancel!";

          console.log("Complete the Payment")

        }

      }

    }

  };

  var rzp1 = new Razorpay(options);

  document.getElementById('rzp-button1').onclick = function (e) {

    rzp1.open();

    e.preventDefault();

  }

</script>

</html>

No comments:

Post a Comment