react-paystack icon indicating copy to clipboard operation
react-paystack copied to clipboard

The `invoice.update` event isn't getting called in webhook

Open unclebay143 opened this issue 2 years ago • 1 comments
trafficstars

Hi team,

For some unknown reason, the invoice.update event isn't getting called in our webhook when a subscription is renewed by Paystack.

Here's the switch case that covered the event. Are we probably doing something wrong? Other events work as expected.

case 'invoice.update':
  if (data.status === 'success' && data.paid) {
    await Subscription.findOneAndUpdate(
      { userId },
      {
        $set: {
          startDate: data.period_start,
          endDate: data.period_end,
          customerCode: data.customer.customer_code,
          subCode: data.subscription.subscription_code,
          amount: data.amount,
          currency: data.currency,
        },
      },
    )
  }
  break
  • Using Next.js

unclebay143 avatar Mar 15 '23 07:03 unclebay143

is this related to webhook or react lib?

iamraphson avatar Apr 02 '23 17:04 iamraphson