htmldjangorazorpayblocked

While Clicking On Razorpay Pay Now Using CARD / WALLET The New Tab Is about:blank#blocked , Django


I used to integrate django and razor pay , but when i click on pay now on options like , card , wallet , ( the payment needed to be in open in new tab ) the page become blank , i cannot access the success page Note: Upi is working and i am getting the result in dashboard , also payment id is generated and its reflecting in razorpay dash board

Script Also Loaded

My template .html


<button id="rzp-button1" class="btn btn-primary my-2 w-100">Pay with Razorpay</button>

<script>
    var options = {
        "key": "KEY", // Enter the Key ID generated from the Dashboard
        "amount": "{{payment.amount}}", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
        "currency": "INR",
        "name": "Acme Corp",
        "description": "Test Transaction",
        "image": "https://example.com/your_logo",
        "order_id": "{{payment.id}}", //This is a sample Order ID. Pass the `id` obtained in the response of Step 1
       // "callback_url": "https://eneqd3r9zrjok.x.pipedream.net/",
        "prefill": {
            "name": "Gaurav Kumar",
            "email": "gaurav.kumar@example.com",
            "contact": "9000090000"
        },
        
        "handler": function (response){
            alert(response.razorpay_payment_id);
            alert(response.razorpay_order_id);
            alert(response.razorpay_signature)
        },

        "notes": {
            "address": "Razorpay Corporate Office"
        },
        "theme": {
            "color": "#3399cc"
        },
        
    };
    var rzp1 = new Razorpay(options);
    rzp1.on('payment.failed', function (response){
        alert(response.error.code);
        alert(response.error.description);
        alert(response.error.source);
        alert(response.error.step);
        alert(response.error.reason);
        alert(response.error.metadata.order_id);
        alert(response.error.metadata.payment_id);
    });

    document.getElementById('rzp-button1').onclick = function(e){
        rzp1.open()
        e.preventDefault();
    }
    </script>
```[![enter image description here](https://i.sstatic.net/rFJBZ.png)](https://i.sstatic.net/rFJBZ.png)


[![enter image description here](https://i.sstatic.net/eTuCQ.png)](https://i.sstatic.net/eTuCQ.png)

I need to find out the problem and get card or wallet be enabled

Solution

  • In settings.py just add the line

    SECURE_CROSS_ORIGIN_OPENER_POLICY = "same-origin-allow-popups"

    it works for me

    Thanks