Make sure you don't miss this very important webhook or else your customers will remain on paid plans that they no longer pay for.
-
-
Save stevepeak/2a22b6a648f890e2a6aaae24600d4f8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete subscriptions when they are deleted by Stripe | |
when stripe events customer_subscription_deleted as subscription | |
customer = stripe retrieve_customer id:subscription["customer"] | |
psql update table:"users" values:{"subscribed": false} where:{"email": customer["email"]} | |
mailgun send to:customer["email"] | |
from:"[email protected]" | |
subject:"Subscription Cancelled" | |
text:"Your subscription has been cancelled due to a failed payment." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment