Reputation: 158
I want my customers to get notified if the recurring payments fail on Stripe. They should be notified via email that Stripe has declined their Credit Card. I have read about webhooks but not quite sure how to use them. And also how can I know every time any card has been declined on Stripe.com?
Upvotes: 0
Views: 1623
Reputation: 1852
The idea with webhooks is that you register a url with the remote party and once they have something to tell you they "call" that url passing it parameters.
With stripe you do that on their dashboard under webhook settings.
Then all you have to do is apply your logic in the url you supplied. If it is www.example.com/webhooks/stripe then you need a webhook
controller with a stripe()
method that will parse the data.
So in your stripe()
method you wait for the charge.fail
event (read Stripe's API) and once you get that you send the email and perhaps update your database as well.
Upvotes: 1