Using N8N unable to generate Razorpay QR code

my issue is, earlier using the razorpay doc ai, I figured out how to generate a qr code using api of razorpay using n8n, but I forgot now. How I did it, I mean the api secret and credential thing. I hope this is the area the problem is. I’m sharing the details how it is set, and the error.

error: Problem in node ‘HTTP Request‘
JSON parameter need to be an valid JSON

Settings:
Method : POST
URL: https://api.razorpay.com/v1/payments/qr_codes
Authentication: None
Send Query Parameters : Switch off
Send Headers:
Header Parameters:
Content-Type: application/json
Authorization: key:secret

Send Body
Using JSON
json body: {“type”: “upi_qr”,
“name”: “ANY”,
“usage”: “single_use”,
“fixed_amount”: true,
“payment_amount”: 12390,
“description”: “Any Service Payment”,
“close_by”:1716549216 }

what wrong I’m doing?

My n8n app is working fine hosted in heroku. Webhook and other things are working fine. version 1.42.1

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Can someone please help me with this. I have very few days, I’m on a free trial my subscription will get over in few days, if not completed within time. I can’t do it afterwards.

Please someone who can tell me how to configure it. the postman is working fine. used basic Auth to send the id and secret. that means the json body is fine, there is just problem with the header configuration, and authentication. i’m unbale to understand how to do that. So I will suceed.

1 Like

New update with this situation, I have sent the key and secret in base64 format exactly in this format Basic in the header naming Authorization. Now I’m getting empty response, but no qr generated.

The error message is ‘JSON parameter need to be an valid JSON’; when I tried to validate the JSON it seems the quotes are the problem. Try replacing it with the following:

{
  "type": "upi_qr",
  "name": "ANY",
  "usage": "single_use",
  "fixed_amount": true,
  "payment_amount": 12390,
  "description": "Any Service Payment",
  "close_by": 1716549216
}

Could you please share how you made the Authorization . My authentication is showing failed. And it’s not the quotes, because it’s written in the json in N8N it’s just showing here like that way. The error I’m getting is authentication failed. I’m giving the body exactly copying.

{ "type": "upi_qr",
  "name": "ANY",
  "usage": "single_use",
  "fixed_amount": true,
  "payment_amount": 12390,
  "description": "ANY Service Payment"
}


Method: POST

URL: https://api.razorpay.com/v1/payments/qr_codes

Authentication :None

And the headers I mentioned earlier.

Could you please share that what headers you used and exact words .

I think you may be sending the authentication incorrectly. According to their API docs you need to setup Basic Auth. You can do that from within the HTTP request node:

image