razorpay / razorpay-node

Razorpay node.js bindings
MIT License
182 stars 111 forks source link

request.body is empty in webhook request #402

Closed harshSaf09 closed 7 months ago

harshSaf09 commented 7 months ago

Steps to reproduce the behavior

I cannot provide exact code to reproduce.

  1. Create a webhook
  2. Entered my server's url made for webhook which was something like this https://xyz/api/v/webhook/subscriptionEvent
  3. Added all the subscription event
  4. When I am creating a subscription the webhook is calling the correct api but the req.body is empty

Expected behavior

I was expecting request.body in the request payload.

Actual behavior

It is making a POST req on correct url but without any body. I am getting all the desired request headers but not body.

Code snippets

if (!request.body) {
            response.status(400).json({
                error: 'Bad request. Body cannot be null in request',
            })
            return
        }
// This part of the code is failing.

Node version

node js v 18

Library version

razorpay v 2.9.2

Additional Information

When using this https://public.requestbin.com/ website I am getting the body along with the payload but what can be the probable cause with my server url?