We've moved discussions to Discord

Custom Webhook Stripe on Hatchbox KO

Jerome IDYLLE
Hi,

I created a custom webhook to handle 'stripe.charge.succeeded' event and do some custom code.
Everything works fine in my development environement but I don't understand why the same code doesn't work on my Hatchbox prod environnement.

Here my config:

In config/initializers/stripe_webhook.rb
class StripeWebhook
  include Rails.application.routes.url_helpers

  def call(event)
    Rails.logger.info '*****************************************************'
    Rails.logger.info event.to_json
    object = event['data']['object']
    metadata = object['metadata']

    # custom code .....
    Rails.logger.info '*****************************************************'
  end
end

Pay::Webhooks.delegator.subscribe 'stripe.charge.succeeded', StripeWebhook.new

On Stripe dashboard webhook log page, I can see that the charge.succeeded event is handled correctly and the webhook return a 200 but my custom code webhook is not processed and I don't see the debug logs in production.log.

My guess is that "Pay::Webhooks.delegator.subscribe ..." not works in my production environnement and only the default pay gem "/webhooks/stripe" is running.

After several tries I can't find the solution... any idea?

Thank you.

Jerome IDYLLE
For information, this issue has been solved. This was due to the Sidekiq configuration on Hatchbox.
Webhook delegator code does not run if Sidekiq is disabled.
Jerome IDYLLE
Hi,

I created a custom webhook to handle 'stripe.charge.succeeded' event and do some custom code.
Everything works fine in my development environement but I don't understand why the same code doesn't work on my Hatchbox prod environnement.

Here my config:

In config/initializers/stripe_webhook.rb
class StripeWebhook
  include Rails.application.routes.url_helpers

  def call(event)
    Rails.logger.info '*****************************************************'
    Rails.logger.info event.to_json
    object = event['data']['object']
    metadata = object['metadata']

    # custom code .....
    Rails.logger.info '*****************************************************'
  end
end

Pay::Webhooks.delegator.subscribe 'stripe.charge.succeeded', StripeWebhook.new

On Stripe dashboard webhook log page, I can see that the charge.succeeded event is handled correctly and the webhook return a 200 but my custom code webhook is not processed and I don't see the debug logs in production.log.

My guess is that "Pay::Webhooks.delegator.subscribe ..." not works in my production environnement and only the default pay gem "/webhooks/stripe" is running.

After several tries I can't find the solution... any idea?

Thank you.

Jerome IDYLLE
For information, this issue has been solved. This was due to the Sidekiq configuration on Hatchbox.
Webhook delegator code does not run if Sidekiq is disabled.
Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC