Product
Strict Security Headers Can Silently Kill Razorpay Checkout
I tightened my site's security headers and the Razorpay pay button stopped doing anything. No visible error, no failed request in the backend. Here are the five CSP rules and one Permissions-Policy line that fixed it.
razorpay checkout csprazorpay content security policyrazorpay checkout not opening
The pay button did nothing. I clicked it, no modal opened, no spinner, no message on the page. If I had not had the browser console open, I would have started debugging my backend.
The cause was a security header I had added a week earlier. This is the full list of what a strict Content-Security-Policy has to allow for Razorpay Checkout, plus one non-CSP header that is easy to miss.
Why does Razorpay Checkout fail silently under a strict CSP?
A Content-Security-Policy tells the browser which origins a page may load scripts, frames and images from, and where it may send requests. Anything not on the list is blocked. The block shows up as a console error, not as anything a visitor sees.
On 10 September 2026 I added a CSP to my site’s server as part of a security-headers pass. Razorpay Checkout loads a script, opens a modal in a frame, talks to several endpoints and posts a form during bank authentication. My policy allowed none of that.
So the button threw a console error and did nothing. To a user it looks like a dead button. To a developer it looks like a backend bug, which is where I would have wasted time. I found it on 18 September while wiring up a new checkout, before that page went live. I think that timing was luck, and I would not count on being so fortunate twice.
Which CSP directives does Razorpay need?
Five directives:
| Directive | Allow | Why |
|---|---|---|
script-src | https://checkout.razorpay.com | The Checkout widget itself |
frame-src | https://api.razorpay.com https://checkout.razorpay.com | The modal, and the bank’s 3-D Secure step |
connect-src | https://api.razorpay.com https://lumberjack.razorpay.com https://lumberjack-cx.razorpay.com | API and logging requests |
form-action | https://api.razorpay.com | 3-D Secure posts a form |
img-src | https://cdn.razorpay.com https://*.rzp.io | Bank and method logos |
Add these to your existing values. Do not replace what is already there.
What is the Permissions-Policy line people miss?
This one is not CSP at all, which is why it gets missed.
If you ship Permissions-Policy: payment=(), you block the Payment Request API for everyone. Checkout still opens, but wallet options silently disappear inside the modal. Nothing errors, so you may not notice until someone asks where the wallets went.
Allow the page itself and the two Razorpay origins:
Permissions-Policy: payment=(self "https://api.razorpay.com" "https://checkout.razorpay.com")
What does the full header block look like?
A copyable starting point. Merge it into your own policy and keep your other directives:
Content-Security-Policy:
script-src 'self' https://checkout.razorpay.com;
frame-src https://api.razorpay.com https://checkout.razorpay.com;
connect-src 'self' https://api.razorpay.com https://lumberjack.razorpay.com https://lumberjack-cx.razorpay.com;
form-action 'self' https://api.razorpay.com;
img-src 'self' data: https://cdn.razorpay.com https://*.rzp.io
Permissions-Policy: payment=(self "https://api.razorpay.com" "https://checkout.razorpay.com")
I have shown 'self' and data: as common placeholders. Your site will have its own analytics, fonts and other origins, so this block is a template for the Razorpay parts, not a complete policy.
How do I debug a Razorpay button that does nothing?
- Open the browser console before you click. CSP violations are logged there with the exact directive and blocked URL.
- Fix one directive at a time and reload. The console tells you the next one that fails.
- Open the Network tab. If no request to Razorpay appears at all, the script itself is blocked, which points at
script-src. - If the modal opens but the bank step fails, look at
frame-srcandform-action. - If the modal works but wallets are missing, check
Permissions-Policy.
I would also run a test payment with a real bank flow, not only open the modal. The 3-D Secure step needs form-action, and a test that stops at the modal never reaches it.
Does this apply to every checkout behind the same headers?
Yes. If several products sit behind one server config, every one of them inherits the policy. I made a note to re-check this before wiring Razorpay into anything else behind the same headers, because the fix on one page does nothing for a different server.
Razorpay may add or change domains over time, so I would treat the list above as what worked for me in September 2026 and not as permanent. If a checkout breaks months later with no code change, compare the console’s blocked URLs against this table first.
If you are setting up Razorpay for the first time, read the fee maths too. I covered the real rate and a pricing trap in Razorpay’s 2% fee is really 2.36%.
Quick checklist
- Five CSP directives opened: script, frame, connect, form-action, img.
Permissions-Policy: payment=(...)lifted for Razorpay origins.- Console open during every checkout test.
- A full test payment through the bank step, not only the modal.
- Re-checked on every other product behind the same headers.