razorpay / razorpay-node

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

Not receiving webhook response when cancelling at period end. #337

Open whoopydev opened 1 year ago

whoopydev commented 1 year ago

Hey guys,

When I cancel a subscription at period end, I don't get back any webhook response. Nothing on the dashboard changes either, except a green notification bar pops up and says the subscription will be cancelled at period end, but aside from that no changes. Invoices still show that the next invoice will be billed.

I am getting webhook responses successfully for everything else.

If this doesn't work, I would have to let my customers cancel their subscription immediately, and manually continue their access to premium content till period ends on my side, and this would be very cumbersome.

How can I allow them to cancel their subscription when period ends and why am I not getting a webhook response when I do this?

Also, the code doesn't work:

  await razorpay.subscriptions.cancel(sub_id, {
    cancel_at_cycle_end: 1
  })

I get the following error: Error: The second parameter, Cancel at the end of cycle should be a Boolean. If I change it to true or false I still get that error.

Allowing users to cancel a subscription at period end is pretty basic functionality. If this way doesn't work, please recommend how I can allow users to cancel their subscription at period end.

Also, I would recommend adding functionality similar to Stripe, where they send cancel_at_period_end (which is a bool) with their webhook responses to easily implement this functionality.

Thanks

ankitdas13 commented 1 year ago

@whoopydev Have you resolved this issue ? Also, please update the node sdk to the latest version v2.8.6 & let me know if the issue still persists or not

ankitdas13 commented 1 year ago

@whoopydev could you please confirm?