dj-stripe / dj-stripe

dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and faster.
https://dj-stripe.dev
MIT License
1.56k stars 474 forks source link

DJSTRIPE_WEBHOOK_EVENT_CALLBACK deprecated. How to use djstripe.signals? #2034

Open sourcesolver opened 1 month ago

sourcesolver commented 1 month ago

When I try to use DJSTRIPE_WEBHOOK_EVENT_CALLBACK in my settings.py, I get:

WARNINGS:
?: DJSTRIPE_WEBHOOK_EVENT_CALLBACK is deprecated. See release notes for details.
        HINT: If you need to trigger a function during webhook processing, you can use djstripe.signals instead.
Available signals:
- djstripe.signals.webhook_pre_validate
- djstripe.signals.webhook_post_validate
- djstripe.signals.webhook_pre_process
- djstripe.signals.webhook_post_process
- djstripe.signals.webhook_processing_error

I WANT to hook djstripe.signals.webhook_processing_error, but I could not find any clear documentation on how to do this (in my settings.py? models.py??) Can someone point me to a good EXAMPLE? Or tap out how to do so here?? There is mention (https://sourceforge.net/projects/dj-stripe.mirror/files/2.8.0/) of "instance" and "api_key" also being sent as arguments to djstripe.signals.webhook_processing_error -but no example!

Thanks in advance...

jleclanche commented 1 month ago

Hi @sourcesolver

You can refer to the documentation on django signals here: https://docs.djangoproject.com/en/5.0/topics/signals/

It should be possible to from djstripe.signals import webhook_processing_error, and use webhook_processing_error as a signal you can connect to with your callback. webhook_processing_error.connect(my_error_processing_callback).