charmaine avatar
charmaine
courteousAzureSquirrel
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team a Discord notifcation and sends a welcome email to the new subscriber. It takes a couple of steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
charmaine avatar
charmaine
comfortableTurquoiseMarsupial
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team a Discord notifcation and sends a welcome email to the new subscriber. It takes a couple of steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
charmaine avatar
charmaine
newStripeSubscriber
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team a Discord notifcation and sends a welcome email to the new subscriber. It takes a couple of steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
charmaine avatar
charmaine
newStripeEvent
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team a Discord notifcation and sends a welcome email to the new subscriber. It takes a couple of steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
stevekrouse avatar
stevekrouse
wondrousPinkPerch
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team a Discord notifcation and sends a welcome email to the new subscriber. It takes a couple of steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
lgug2z avatar
lgug2z
stripeSubscriptionDiscordNotification
HTTP
Discord Notifications for Stripe Subscriptions This val processes new subscriptions to komorebi's individual personal use license by sending a notifcation to the community Discord server. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your STRIPE_READ_ONLY_API_KEY to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to your Val Town Env Variables Add your Discord webhook URL as STRIPE_DISCORD_WEBHOOK_URL to your Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
stevekrouse avatar
stevekrouse
newThankYouEmailVersion
HTTP
New Stripe Subscription Handler This val handles new subscribers on Stripe: Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends a message to our internal Discord channel Sends a thank you to the new subscriber Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early, before the user's payment actually goes through. This is a problem because in early Nov 2024 we started getting credit card fraudsters testing cards using our service. We started getting lots of notifications for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe to customer.subscription.updated . This event happens on any subscription change, including renewals and cancellations, so now we have to filter those events to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
Forked from stevekrouse/newStripeSubscriber
1
Next
stevekrouse-newstripesubscriber.web.val.run
Updated: December 13, 2024