#bhanu365 - webhooks
1 messages · Page 1 of 1 (latest)
Hello, yes there are events for all of those except for maybe the reminder before the auto-renew
I can link to the events in a moment, in the mean time here is a very good doc on subscriptions that includes the events to listen for in many scenarios https://stripe.com/docs/billing/subscriptions/overview
Can you refer a link where I can see all of those events.
customer.subscription.updated or invoice.paid would be best for subscription renewal
invoice.payment_failed would be best for the payment failure
invoice.upcoming for the reminder
customer.subscription.updated for upgrade
And customer.subscription.deleted for cancelation
How can I test and trigger that webhooks?
And how can i increase and decrease the date of the subscription. Just want to test so I can easily test when any subscription auto renew, exipred etc
If you mean you want to simulate time passing, our test clocks are very helpful for that https://stripe.com/docs/billing/testing/test-clocks
If that is not quite what you meant, let me know
Can I test with the local URL. just want to get the response on local when webhook are triggered.
http://127.0.0.1:8000/webhook/subscriptions
This is my local URL
For that you can use the CLI's listen command https://stripe.com/docs/cli/listen
I have trigger an event but where I can see the response that I have printed in the code?
Where is your code?
Are you running that code in visual studio or somewhere else?
It looks like this isn't defined by Stripe, this depends on how/where you are running your code
Right, so unfortunately I don't know where you would see your output. This is your environment
I'm asking you where I can see the output of my printed code?
How i can check what actually I am getting the response of webhook event
?
hello
You seem to be misunderstanding how webhooks work
Stripe's server sends an HTTP request to your server. There's no "browser" or anything in between, so there's no way to just echo things and see them
What we recommend is logging to a file if you need to debug, that way you can read the file with logs after a request and debug it. That's what I do in my code ```
$msg = "Got Event: '" . $event_json->id . "' with type '" . $event_json->type . "'\n";
file_put_contents("./log.txt", $msg, FILE_APPEND);