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

charmaine

stripe

Public
Like
stripe
Home
Code
6
README.md
H
index-test.ts
H
index.ts
H
simple-test.ts
H
test-small-invoice.ts
H
test.ts
Branches
1
Pull requests
Remixes
History
Environment variables
3
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
/
README.md
Code
/
README.md
Search
10/7/2025
Viewing readonly version of main branch: v43
View latest version
README.md

Stripe Val Town Teams Invoice Discord Notifier

This val receives Stripe webhook notifications when Val Town Teams invoices ($50+) are paid and sends notifications to Discord. Regular smaller invoices are filtered out.

Features

  • ✅ Filters for Val Town Teams invoices only (≥$50)
  • ✅ Verifies Stripe webhook signatures for security
  • ✅ Sends rich Discord embeds with payment details
  • ✅ Includes invoice amount, customer info, billing period, and invoice number
  • ✅ Links to the hosted invoice when available
  • ✅ Proper error handling and logging

Setup Instructions

1. Environment Variables

You need to set these environment variables in your Val Town settings:

  • STRIPE_SECRET_KEY: Your Stripe secret key (starts with sk_)
  • STRIPE_WEBHOOK_SECRET: Your Stripe webhook endpoint secret (starts with whsec_)
  • DISCORD_WEBHOOK_URL: Your Discord webhook URL

2. Discord Webhook Setup

  1. Go to your Discord server settings
  2. Navigate to Integrations → Webhooks
  3. Click "New Webhook"
  4. Choose the channel where you want notifications
  5. Copy the webhook URL and set it as DISCORD_WEBHOOK_URL

3. Stripe Webhook Setup

  1. Go to your Stripe Dashboard → Developers → Webhooks
  2. Click "Add endpoint"
  3. Set the endpoint URL to: https://charmaine--19e6c204a3a811f0a7f30224a6c84d84.web.val.run
  4. Select the event: invoice.payment_succeeded
  5. Copy the webhook signing secret and set it as STRIPE_WEBHOOK_SECRET

4. Testing

Quick Tests (Available in this project):

  • Val Town Teams Invoice Test: Visit simple-test.ts - Tests a $50 invoice (should trigger notification)
  • Small Invoice Filter Test: Visit test-small-invoice.ts - Tests a $29.99 invoice (should be filtered out)

Production Testing:

  1. Stripe CLI (Recommended):

    stripe listen --forward-to https://charmaine--19e6c204a3a811f0a7f30224a6c84d84.web.val.run stripe trigger invoice.payment_succeeded
  2. Stripe Dashboard: Send test webhooks from Developers → Webhooks → Send test webhook

  3. Real Invoice: Create a test Teams invoice in Stripe and mark it as paid

Webhook Events

Currently handles:

  • invoice.payment_succeeded - When a Val Town Teams invoice (≥$50) is successfully paid

Filtering Logic

The webhook only processes invoices where:

  • amount_due OR total OR amount_paid ≥ 5000 cents ($50.00)
  • This ensures only Val Town Teams invoices trigger notifications

Security

  • Webhook signature verification ensures requests are from Stripe
  • Environment variables keep sensitive data secure
  • Proper error handling prevents information leakage

Discord Notification Format

The Discord notification includes:

  • 💰 Amount (in USD)
  • 📄 Invoice number
  • 👤 Customer email/info
  • 📅 Billing period (start - end dates)
  • ✅ Payment status
  • 🔗 Payment intent ID
  • 🔗 Link to view the invoice (if available)
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
© 2026 Val Town, Inc.