• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
charmaine

charmaine

Demo

Public
Like
Demo
Home
Code
2
README.md
H
stripe-to-discord.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
stripe-to-discord.ts
https://charmaine--b3a2866a310411f09167569c3dd06744.web.val.run
README.md

Stripe to Discord Notification Automation

This Val Town script creates a webhook endpoint that receives Stripe events and forwards them as nicely formatted notifications to a Discord channel.

Features

  • Receives and verifies Stripe webhook events
  • Formats different event types into readable Discord messages
  • Supports multiple event types (payments, subscriptions, invoices)
  • Color-coded notifications based on event type
  • Secure webhook signature verification

Setup Instructions

1. Discord Webhook Setup

  1. Open your Discord server
  2. Go to Server Settings > Integrations > Webhooks
  3. Click "New Webhook"
  4. Name your webhook (e.g., "Stripe Notifications")
  5. Choose which channel to post to
  6. Copy the webhook URL

2. Val Town Environment Variables

Add the following environment variables to your Val Town account:

  • DISCORD_WEBHOOK_URL: The Discord webhook URL you copied
  • STRIPE_WEBHOOK_SECRET: Your Stripe webhook signing secret (you'll get this in the next step)

3. Stripe Webhook Configuration

  1. Log in to your Stripe Dashboard
  2. Go to Developers > Webhooks
  3. Click "Add endpoint"
  4. Enter the URL of this Val (copy it from the "Endpoint URL" in Val Town)
  5. Select the events you want to receive notifications for:
    • charge.succeeded
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.paid
    • invoice.payment_failed
    • (Add more as needed)
  6. Click "Add endpoint"
  7. Reveal and copy the signing secret
  8. Add this as the STRIPE_WEBHOOK_SECRET environment variable in Val Town

Customization

You can customize this automation by:

  1. Adding more event types to the SUPPORTED_EVENTS array
  2. Modifying the formatting logic in formatStripeEventForDiscord()
  3. Changing the color scheme in the COLORS object

Troubleshooting

  • Check the Val Town logs for any errors
  • Verify that your webhook secret is correct
  • Make sure your Discord webhook URL is valid
  • Test with Stripe's webhook testing tool

Security Notes

  • Never share your Stripe webhook secret
  • The webhook verification ensures that only Stripe can trigger notifications
HTTP
  • stripe-to-discord.ts
    charmaine--b3…44.web.val.run
Code
README.md
H
stripe-to-discord.ts
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.